@Albert

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

Using --writer=sample.lua does not work.
Error: "Unknown option --writer."

I now know why using "--to" did not work.

2/ Accessing variables in lua filter
I would like to have access to "variables" in lua filter.
Currently I have access to "metadata" when I use "function Pandoc(doc) ... end"
In the doc: https://pandoc.org/custom-writers.html#a-custom-html-writer, I saw this "function Doc(body, meta, vars) ... end" but it's never called in my tests.
I prefer not to use "function Writer" for now if possible.
Do you have any tips or working examples for that one?

Thanks

Le jeudi 2 juin 2022 à 07:33:54 UTC+2, Albert Krewinkel a écrit :

Felix SOEDJEDE <soef...@gmail.com> writes:

> In Pandoc 2.18, custom writers were added:
> https://pandoc.org/custom-writers.html#new-style
>
> I tried to use it but it's not working and I don't know if it's an
> error or I'm using it the wrong way.
>
> [...]
>
> Command used "pandoc --standalone --verbose --lua-filter=sample.lua
> --output=output.md sample.md"

Pandoc expects the custom writer to be given as the argument of
`-t`/`--to`/`-w`/`--write`.

pandoc --standalone --verbose --to=sample.lua ...

> Does anyone have a minimal working example for "Doc" or "Writer" I
> could use?

Here's a custom Markdown writer. It's an experiment designed to show how
a new writer might be structured. It's a bit slow though.
https://gist.github.com/tarleb/5a9c3fbfa47b0e6d3643efd8af2994b9


--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/cde6d369-8813-41ed-a1ea-253901014b46n%40googlegroups.com.