Checking the div class is working nicely, thanks! Using metadata probably is the way to go, but I'm not sure how to get my custom metadata value in the .lua script, do you have some quick example how to use it? On Monday, March 14, 2022 at 1:23:56 PM UTC+1 denis...-NSENcxR/0n0@public.gmane.org wrote: > Can’t come up with a piece of code right now, but one way to do this is to > check whether a div contains a certain class. If it contains the class just > return the element, otherwise `return {}`. > > > > I don’t know if there are easy ways to pass command line parameters to the > filter, but I guess you can use the -M flag to add a metadata value (e.g. > pandoc file.md -o output.html -M docpart=doc1), and use that in your filter. > > > > Best, > > Denis > > > > *Von:* pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org *Im > Auftrag von *Balázs Szabó > *Gesendet:* Montag, 14. März 2022 13:05 > *An:* pandoc-discuss > *Betreff:* Convert specific parts of document > > > > I have a markdown file of which I want to convert sometimes only specific > parts, sometimes the whole document. I know about lua-filters and fenced > div which I think is a possible approach, but how can I "select" which part > of the document I'm converting. > > Let's say this is my document: > > *# This is my title* > > *This is some common parts for both documents.* > > > > *:::: DOC1* > > *This is a part for Document 1.* > > *::::* > > > > *:::: DOC2* > > *This is a part for Document 2.* > > *::::* > > > > *Some more common parts... * > > How can I tell pandoc/lue-filter if I want to create "Document1" for > example? Can I somehow pass a custom argument from the command line that > lua-filter can pick up (e.g. DOC1 or full)? > > Any other way of achieving this? > > -- > 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/944c34cc-7875-4bd1-8dd1-b3e702672e32n%40googlegroups.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/d3092493-038f-484f-896e-83b3b20cb38bn%40googlegroups.com.