public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: ChrisD <cd34-gg-4SSc53hpTiu9TMao6EloiEEOCMrvLtNR@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Lua filter documentation errors?
Date: Thu, 24 Oct 2019 12:35:17 -0700	[thread overview]
Message-ID: <193ee2fd-7b82-6176-5cfd-353353816019@intielectronics.com> (raw)

I have been playing with lua filters, and I have a few corrections to the lua-filters page in the documentation. Nothing urgent, just figured I would pass these along...

1) The example for mediabag.fetch (https://pandoc.org/lua-filters.html#mediabag-fetch) is incorrect. Fetch returns two values. The second line should read:

     local mt, contents = pandoc.mediabag.fetch(diagram_url, ".")

2) In the mediabag list example usage (https://pandoc.org/lua-filters.html#mediabag-list), the for statement is incorrect. It needs a "do", and the colon should be removed.

3) The docs on mediabag (https://pandoc.org/lua-filters.html#module-pandoc.mediabag) say that "The media bag is used when pandoc is called with the --extract-media or --standalone option."

The media bag appears to be populated only when --extract-media is used, and not if --standalone is used without --extract-media.

4) The example for replacing placeholders with metadata values (https://pandoc.org/lua-filters.html#replacing-placeholders-with-their-metadata-value) fails if the metadata includes boolean values.

For example, if your YAML includes a line such as:
     toc: true

The code will fail with the error "attempt to index a boolean value". That's because boolean values are stored in the metadata table as MetaBools, which are lua booleans, not tables, and the "v.t" will fail. I believe this code will also fail if the metadata table contained a MetaString, though I do not know how to get a MetaString into the meta table; strings seem to be represented as MetaInlines. The code should check for MetaBools and MetaStrings, or check that (type(v) == "table").






-- 
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/193ee2fd-7b82-6176-5cfd-353353816019%40intielectronics.com.


             reply	other threads:[~2019-10-24 19:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24 19:35 ChrisD [this message]
     [not found] ` <193ee2fd-7b82-6176-5cfd-353353816019-4SSc53hpTiu9TMao6EloiEEOCMrvLtNR@public.gmane.org>
2019-10-25  5:18   ` John MacFarlane

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=193ee2fd-7b82-6176-5cfd-353353816019@intielectronics.com \
    --to=cd34-gg-4ssc53hptiu9tmao6eloieeocmrvltnr@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).