You'll be pleased to know that the dev version of pandoc does create a more full table of contents, so after the next release your script shouldn't be needed.

On Thursday, October 25, 2012 10:16:34 PM UTC-7, Jason Morrison wrote:
I've written a Ruby script that post-processes the EPUB file to inject a more full table of contents.  It includes h1 (chapter), h2 and h3 section levels.

I've pasted the script here: https://gist.github.com/e3158a3bba95b34ce9c0 - it's pretty hacky, but does the job for me.

My Haskell's not sufficiently up to snuff to include a patch to do this properly, and I'm not sure there's a way to iterate over chapters+sections in the templates (e.g. epub-titlepage.html).

Also, in another thread, John @jgm asked for an example of an EPUB with this kind of inline TOC, but I can't for the life of me find the thread/GH issue.  Anyway, I included and an example before/after contents.opf and the new contents.xhtml in the paste as well.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/pandoc-discuss/-/P_re1cppfJYJ.
For more options, visit https://groups.google.com/groups/opt_out.