From: Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Lua filter to process chunkedhtml output
Date: Fri, 20 Jan 2023 16:46:49 +0100 [thread overview]
Message-ID: <87wn5hkxie.fsf@zeitkraut.de> (raw)
In-Reply-To: <CAEe_xxiQAz2MVihALKGes6Ai=UrOPKgkvGq19ULiLsjBhTuTbQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
"'William Lupton' via pandoc-discuss" <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> writes:
> Re this:
>
>> Also, I tried to print the value of PANDOC_WRITER_OPTIONS, but
> wlupton's logging.lua errors on it (bad argument #1 to 'for iterator'
> (table expected, got light userdata))
>
> I investigated, and parts of the writer options are "light userdata"
> (I hadn't heard of that). I've committed and merged a fix that will
> report such items as "<pointer>". You can now list most of the writer
> options (just a few colors show as <pointer>).
>
> I'm not sure whether the use of light userdata is intentional here
> (this isn't a 3.0 thing; it was already the case in previous
> versions). Albert?
Let's call it semi-intentional: what happens is that we go via JSON to
create the Lua representation of the writer options. The problem is
that, if a JSON value is `null`, we can't use `nil` in Lua because that
would make the key "disappear", i.e., it would not show up when
iterating through the resulting table with `pairs`. So, in an effort to
gain compatibility with the very popular Lua library "cjson", we
represent `null` values as C null pointers. Hence the "light userdata".
The one solution I can think of is to set a custon `__pairs` metamethod
on PANDOC_WRITER_OPTIONS. That would allow us to set the missing values
to `nil`, while still having `pairs(PANDOC_WRITER_OPTIONS)` list all
supported keys. Please feel free to raise an issue for this on GitHub.
--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
next prev parent reply other threads:[~2023-01-20 15:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-19 13:44 ChrisD
[not found] ` <d5298c4a-9427-8f5b-c646-6370a3f998df-4SSc53hpTiu9TMao6EloiEEOCMrvLtNR@public.gmane.org>
2023-01-19 17:12 ` John MacFarlane
[not found] ` <1D22B433-211B-4033-8A63-F637F52B2008-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2023-01-19 17:14 ` John MacFarlane
2023-01-19 21:32 ` ChrisD
[not found] ` <f761231d-87ea-6bfb-38c3-99eb15184263-4SSc53hpTiu9TMao6EloiEEOCMrvLtNR@public.gmane.org>
2023-01-20 9:54 ` 'William Lupton' via pandoc-discuss
[not found] ` <CAEe_xxiQAz2MVihALKGes6Ai=UrOPKgkvGq19ULiLsjBhTuTbQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-01-20 15:46 ` Albert Krewinkel [this message]
2023-01-20 16:05 ` ChrisD
[not found] ` <fbca8e05-fed7-39e1-08f0-0498c399f33f-4SSc53hpTiu9TMao6EloiEEOCMrvLtNR@public.gmane.org>
2023-01-20 16:29 ` 'William Lupton' via pandoc-discuss
[not found] ` <CAEe_xxiJdneKg+uqja3tdaWzQSWmc5NfO0aMFKaUGa_W1U5+qg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-01-20 16:33 ` 'William Lupton' via pandoc-discuss
[not found] ` <CAEe_xxhhsG_NA+PL+5A2TyHHqNOC-=sdi1jX-NYunf9fsHtH1A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-01-21 12:28 ` 'William Lupton' via pandoc-discuss
[not found] ` <CAEe_xxjkBZfgeh5jDbZNDNrFbG4SKTA0S9qjzaEXgxTr5BZVNw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-01-21 12:33 ` Albert Krewinkel
[not found] ` <87fsc4koud.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2023-01-21 17:41 ` logging.lua and 'light userdata' 'William Lupton' via pandoc-discuss
[not found] ` <CAEe_xxjsmxwx4B_f1j4buVT8P+cdVdVw4q8dbtxiuJNoXsNweQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-01-23 10:49 ` Albert Krewinkel
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=87wn5hkxie.fsf@zeitkraut.de \
--to=albert+pandoc-9eawchwdxg8hfhg+jk9f0w@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).