Since it's Cite maybe you would be better of modifying a CSL style?

As for the general case what I did was creating a filter which totally ate the builtin writer's brains for selected elements by replacing them with a crafted mixture of pieces of the content of the original element and RawInline/RawBlock elements which contained the desired target markup.
(I even wrote a "filter" which turned the output of the plain writer into an unsupported markup language long before there were custom writers!)
 I ended up with the occasional ghost span/div just to hold content though. I suppose you could go through the hassle of using `pandoc.write` on snippets, remove excess markup with Lua's string functions and splice them into one big RawBlock/RawInline, but it's hardly worth it.

Perhaps a set of "example" custom writers which behave like the default writers as nearly as possible which people could modify could be set up. I would gladly contribute if there is a middle ground between reading the Haskell code (which I can't) and just deducing from output in the various formats. Perhaps deducing from test cases so that one knows what to go after.

Note that filters can do multiple passes, and that you can run "local" filters on the children of individual elements with the `walk` functions, which is very useful.

Or do the Haskell writers work in such a way that keyhole surgery via Lua functions is possible or could reasonably be made possible? I suspect they were written without any hooks...

Den tors 24 mars 2022 12:01AustinLe <lhoangan.nl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
I've been searching for a few days and as I could find what I wanted, I'd like to confirm if my conclusion is correct.

In particular, I'd like to overwrite a small writer behavior, e.g. the Cite tag of the default HTML writer, by adding an extra field in the tag. I'm checking the custom writer tag and it seems like I have to re-write the whole writer for all AST elements, and not just replacing `function Cite` in the `sample.lua` with what I needed.

This seems to  be quite a hassle as the provided `sample.lua` doesn't produce the same document as the default HTML writer does (missing table of content, math formulas aren't rendered, question about that here ). 

Is it correct that I have to provide the writer for the all AST elements, or am I missing something and we can actually override just a function only?

--
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-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/3aa35ec0-4912-4fd7-9e11-8a78296f9da4n%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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAkkoqQ4tuft197DH9TwkFLrtMgO9e88mMmTr8WmOYGsw%40mail.gmail.com.