Also, I specified --table-of-contents on the command line, but didn't see it set in the writer's Doc() function. Should I have expected to see it? On Sun, 4 Oct 2020, 16:54 William Lupton, wrote: > Great. Thanks. I can do this. > > But can I then use a template? I didn't mention this earlier, but I tried > setting some variables in the Doc() function (e.g. 'toc') and they didn't > seem to be seen by the template. > > On Sun, 4 Oct 2020, 16:12 John MacFarlane, wrote: > >> >> The table of contents is generated by the HTML writer. >> So, if you create a custom writer, you'll have to reproduce >> this functionality in your writer. >> >> William Lupton writes: >> >> > Hello, >> > >> > % pandoc --version >> > pandoc 2.9.2.1 >> > >> > I want to generate modified HTML for headers (to be specific, I want to >> add >> > a link to each header, like Sphinx does), so I decided to create a >> custom >> > lua writer. >> > >> > I started with the supplied sample.lua and modified the Header() >> function, >> > but I find (when I run with --standalone --table-of-contents) that I >> don't >> > get a ToC. And when I look at the variables in the Doc() function I >> don't >> > see 'toc' or 'table-of-contents'. >> > >> > Should I be able do this, or do I have to use my custom writer to >> generate >> > a fragment and then run pandoc again to process the fragment and >> generate >> > the ToC (I've tried this and it works)? >> > >> > Note: I tried to parse this comment in sample.lua Doc(), but am not >> clear >> > whether it's saying that I can use --template in the _same_ pandoc >> > invocation or whether I need to use a separate invocation: >> > * You could use the metadata table to fill variables in a custom lua >> > template. Or, pass `--template=...` to pandoc, and pandoc will do the >> > template processing as usual. >> > >> > I can supply more detailed info on request. >> > >> > Thanks, >> > William Lupton >> > >> > -- >> > 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/66e3e0f4-a77c-4ff6-b71e-68182d95ac2an%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/CAEe_xxijXFxtfTzRJNp_wmT93ERdFDm_9oauEkrPmjWjT9zfPw%40mail.gmail.com.