That's done it :) pandoc --standalone --toc --number-sections --pdf-engine=xelatex --template pandoc.latex test.docx -o test99.pdf --lua-filter=meta.lua --metadata=metadata_file:metadata.yaml output PDF looks exactly the same as pandoc --standalone --toc --number-sections --pdf-engine=xelatex --template pandoc.latex metadata.yaml test4.md -o test4.pdf On Tuesday, 14 November 2017 10:07:53 UTC+10:30, Kolen Cheung wrote: > > I think you nailed it ;) > > This is safer and more reliable. May be put it somewhere as an example? > (e.g. the lua filter doc.?) > > On Monday, November 13, 2017 at 1:19:02 AM UTC-8, > albert.k...-stqabkCVF6SGlKaCpJGLJw@public.gmane.org wrote: >> >> Lua filters are my hammer which makes everything look like a nail, so >> here is a suggestion on using those to get what you want: >> >> function Meta(meta) >> local f = io.open(meta.metadata_file, 'r') >> local content = f:read('*a') >> f:close() >> return pandoc.read(content).meta >> end >> >> >> Safe the above to a file and call pandoc with >> --lua-filter=.lua and --metadata=metadata_file:. >> It will overwrite all metadata using the contents of the yaml file. >> >> See also this issue: https://github.com/jgm/pandoc/issues/3115 >> >> On Sunday, November 12, 2017 at 10:34:02 PM UTC+1, scl...-DpHT0TjK6O80n/F98K4Iww@public.gmane.org >> wrote: >>> >>> Hmm ok - I'll look into that :) >>> >>> The workflow is probably more edge case from the standard use of pandoc >>> for academic writing. >>> >>> What we want to achieve: >>> >>> User -> editor of choice -> save in native format >>> Apply YAML metadata with user details and extracted customer/client >>> details from CRM >>> Apply customised style to ensure consistency >>> Apply template to ensure consistent cover page, TOC format, >>> copyright/confidentiality notice, commercial in confidence footer >>> >>> Export to PDF for all the good reasons you use PDF for official >>> documents ;) >>> >>> >>> >> -- 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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/1ac11a31-70c6-4b09-9009-3e39f6893f3d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.