BPJ, that did the trick. Thank you for your help! On Fri, Aug 13, 2021 at 3:41 PM BPJ wrote: > Sorry a typo on line 112: change `local keys` into `local keys = {}` > > I must have hit undo one time too many! > > Den fre 13 aug. 2021 19:01Sean McDaniel skrev: > >> Thank you BP for the Lua filter and the explanation. I have attempted to >> run your Lua filter without modifications as a test and I get the following >> error: >> >> Error running filter meta-whitelist.lua: >> meta-whitelist.lua:114: attempt to get length of a nil value (local >> 'keys') >> stack traceback: >> meta-whitelist.lua:114: in function 'Meta' >> >> The issued pandoc command was (note that I put the Lua filter after the >> crossref filter): >> >> pandoc -s --markdown-headings=atx \ >> --filter=pandoc-crossref --lua-filter=meta-whitelist.lua \ >> --from=markdown+raw_attribute+yaml_metadata_block \ >> --to=markdown_phpextra+yaml_metadata_block \ >> -o myfile_phpextra.md myfile.md >> >> I get the same error with or without the crossref filter. >> >> As you've explained (thanks) the metadata fields are created by the >> pandoc-crossref filter. The following without filters works as >> expected---both my YAML header and Markdown blocks are preserved: >> >> pandoc -s --markdown-headings=atx \ >> --from=markdown+raw_attribute+yaml_metadata_block \ >> --to=markdown_phpextra+yaml_metadata_block \ >> -o myfile_phpextra.md myfile.md >> >> The above will probably work for most of my needs, but I was wondering if >> there's a simple Lua filter fix to get it working for my case. >> >> Regards, >> >> Sean >> >> On Tue, Aug 10, 2021 at 3:47 PM John MacFarlane wrote: >> >>> >>> I see. Well, messing with templates won't help. >>> You could write a filter that is applied AFTER >>> pandoc-crossref and removes these metadata fields. >>> >>> BPJ writes: >>> >>> > They are pandoc-crossref configuration options, passed through the >>> metadata >>> > since that is the most convenient way to let the user "communicate" >>> with >>> > filters. >>> > >>> > Den tis 10 aug. 2021 20:09John MacFarlane skrev: >>> > >>> >> Sean McDaniel writes: >>> >> >>> >> > Thank you John. Your suggestions got me most of the way there: the >>> >> markdown >>> >> > code blocks with the +raw_attribute processing are correctly passing >>> >> > through the sections I want untouched and the +yaml_metadata_block >>> is >>> >> > keeping the header content I want. >>> >> > >>> >> > The remaining issue which is giving me trouble is that >>> +yaml_header_block >>> >> > is also including all other document metadata and not just the >>> variables >>> >> > I've defined, i.e. stuff like >>> >> > >>> >> > autoEqnLabels: false >>> >> > autoSectionLabels: false >>> >> > ccsDelim: ", " >>> >> > ccsLabelSep: — >>> >> > ccsTemplate: | >>> >> > *i* >>> >> > *c**c**s**L**a**b**e**l**S**e**p* >>> >> > *t* >>> >> > chapDelim: . >>> >> > >>> >> > and so forth. >>> >> >>> >> I'm not sure why these are going in the metadata -- what is >>> >> setting these metadata elements, if you're not doing it? >>> >> maybe I don't understand the issue. >>> >> >>> >> -- >>> >> 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/m21r71895k.fsf%40MacBook-Pro-2.hsd1.ca.comcast.net >>> >> . >>> >> >>> > >>> > -- >>> > 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/CADAJKhBhk%3DM15HuN-4b%2BbG8NCGBeS6A7YYa3Y2n3Dax22m8MJA%40mail.gmail.com >>> . >>> >> -- 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/CAML5wTV5_Zxz7_ABo%2Bp-22AF9obc4aH1d8uMCc4bzGnyvcKENg%40mail.gmail.com.