Hi Albert, > If you use `function Writer(doc, opts)`, then the variables are available via `opts.variables`. I will see if I can use it > Do you mean an example of a classic custom writers? Pandoc has an example built-in, it's available via > pandoc --print-default-data-file=sample.lua In the output of this command, I have "function Doc(body, metadata, variables) ..." but I've not found how to use it. My real need is that I want to be able to access variables in my lua filters. > Out of curiosity, what output format are planning to generate? Nothing extra. It's just markdown but with some formatting on header, images, etc. The markdown is used to keep documents contents in a readable while also keeping the styles which are relevant. The markdown can then be converted to pdf (via Lualatex), epub, and maybe any other format in the future. Thanks for your replies. I will take a step back and come back to it after few days. Le jeudi 2 juin 2022 à 11:05:50 UTC+2, Albert Krewinkel a écrit : > Hi Felix, > > Felix SOEDJEDE writes: > > > 1/ Writer > > Using --to=sample.lua works when --standalone is not present and . > > Otherwise I have this error: Could not find data file > > templates/default.sample.lua > > Ah, right. With `--standalone` pandoc is looking for a template that > matches the writer name. There isn't one of course. Just omit it. > > > Using --writer=sample.lua does not work. > > Error: "Unknown option --writer." > > Whoops, should have been `--write`. I'm cutting down on coffee, I guess > it shows. 😬 > > > 2/ Accessing variables in lua filter > > I would like to have access to "variables" in lua filter. > > If you use `function Writer(doc, opts)`, then the variables are > available via `opts.variables`. > > > I prefer not to use "function Writer" for now if possible. > > Do you have any tips or working examples for that one? > > Do you mean an example of a classic custom writers? Pandoc has an > example built-in, it's available via > > pandoc --print-default-data-file=sample.lua > > Classic writers are generally a bit easier (IMHO). I'd recommend new- > style writers if you either base the new writer on one that's already > included in pandoc, or if you want to make use of the `pandoc.layout` > module to get nicer looking output. Other than those cases, classic > writers are frequently the better choice. > > Out of curiosity, what output format are planning to generate? > > Cheers, > Albert > > -- > Albert Krewinkel > GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 > -- 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/56920de7-922c-4491-86ee-c981beb37b78n%40googlegroups.com.