public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: BPJ <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org>
To: bpj <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org>
Cc: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Use Writer in Lua Filter?
Date: Sat, 6 May 2023 10:53:05 +0200	[thread overview]
Message-ID: <CADAJKhCiFbdbX7QdtODq3Vd3hemrObiFpi0W9fmf_hyS077T-g@mail.gmail.com> (raw)
In-Reply-To: <CADAJKhCKdyaTdjEVzAzc6+q9vDwGtbjLL_euCEP5G8GEcT9Diw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 3469 bytes --]

Also assigning `nil` to a table key/index deletes that key/index. A table
value can't be `nil`:

``````lua
local t = { a = 1, b = 2, c = 3 }
for k,v in pairs(t) do
  print(k, v)
end
-- prints
-- a    1
-- b    2
-- c    3
-- but in a random order
t.b = nil
for k,v in pairs(t) do print(k,v) end
-- Doesn't print b    2 because it doesn't exist anymore!
``````

Den lör 6 maj 2023 10:35BPJ <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> skrev:

>
>
> Den fre 5 maj 2023 10:04ThomasH <therch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
>
>> Ah, ok, sorry, I've only come to Lua through Pandoc, so I'm often not
>> aware of general Lua features. I will keep an eye open for the 'show'
>> method.
>>
>> T.
>>
>
> See
>
> https://www.lua.org/manual/5.4/manual.html
>
> https://learnxinyminutes.com/docs/lua/
>
> Note that the latter seems to fail to mention that the full syntax for
> long strings and comments includes balanced `=` characters between the
> brackets so that you can include double brackets with or without a lower
> number of `=` chars in the string, e.g.
>
> ``````lua
> local foo = [===[ [==[ [=[ [[ foo ]] ]=] ]==] ]===]
> ``````
>
> is a single string delimited by `[===[` and `]===]`
>
> Also escapes like `\n` don't work in long strings.
>
>
>
>
>> On Friday, May 5, 2023 at 7:26:41 AM UTC+2 Albert Krewinkel wrote:
>>
>>>
>>> ThomasH <the...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>>>
>>> > I just wished that would have been more apparent from the docs.
>>>
>>> The `tostring` function is the default Lua way to convert an object "to
>>> a string in a human-readable format". Still, I made a mental note to add
>>> better docs once we switch from a Haskell to a Lua representation as
>>> `tostring` output.
>>>
>>> The Haskell/native output will probably become available via show
>>> methods, as in `block:show()`. This already works for Block elements,
>>> but not for Inlines.
>>>
>>>
>>> >> Albert Krewinkel <albert...-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> writes:
>>> >>
>>> >> > The alternative is to use `pandoc.write`, e.g.:
>>> >> >
>>> >> > print(pandoc.write(pandoc.Pandoc {element}))
>>> >>
>>> >> The above is missing the second parameter:
>>> >>
>>> >> print(pandoc.write(pandoc.Pandoc {element}, 'native'))
>>>
>>>
>>> --
>>> Albert Krewinkel
>>> GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pandoc-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pandoc-discuss/79a8dca6-9860-4109-b2e8-5841faa36cc0n%40googlegroups.com
>> <https://groups.google.com/d/msgid/pandoc-discuss/79a8dca6-9860-4109-b2e8-5841faa36cc0n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhCiFbdbX7QdtODq3Vd3hemrObiFpi0W9fmf_hyS077T-g%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 6018 bytes --]

  parent reply	other threads:[~2023-05-06  8:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-04  6:00 ThomasH
     [not found] ` <9dc956cf-74a3-4e25-b4bd-62aae6dcc3f4n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-05-04  6:07   ` Albert Krewinkel
     [not found]     ` <87jzxobp5d.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2023-05-04  6:44       ` Albert Krewinkel
     [not found]         ` <87fs8cbnne.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2023-05-04 16:06           ` ThomasH
     [not found]             ` <4c078a54-2252-4253-b2a5-6348ecc1f916n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-05-04 20:59               ` Albert Krewinkel
     [not found]                 ` <878re3bb7a.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2023-05-05  8:03                   ` ThomasH
     [not found]                     ` <79a8dca6-9860-4109-b2e8-5841faa36cc0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-05-06  8:35                       ` BPJ
     [not found]                         ` <CADAJKhCKdyaTdjEVzAzc6+q9vDwGtbjLL_euCEP5G8GEcT9Diw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-05-06  8:53                           ` BPJ [this message]
2023-05-07 10:41                           ` ThomasH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADAJKhCiFbdbX7QdtODq3Vd3hemrObiFpi0W9fmf_hyS077T-g@mail.gmail.com \
    --to=bpj-j3h7gcxpsitlodktgw+v6w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).