--[[ book.lua – Pandoc filter for book files from epub2md_merge.py (HTML output, e.g. PDF via weasyprint). Pandoc's --toc always puts the table of contents (and its own title block) before the whole text, i.e. before the book's cover, title page and imprint. epub2md_merge.py marks the right places:
after the cover, only if the book has no title page of its own after the front matter (cover, title page, imprint …) This filter, for HTML output: * builds the table of contents at the placeholder (use it INSTEAD of --toc; --toc-depth is honoured), * drops Pandoc's title block when the book has its own title page, or moves it to the placeholder, * shows the cover (first chapter with nothing but one picture) without the caption "Cover", * turns the chapter anchors into' .. esc(pandoc.utils.stringify(meta.subtitle)) .. "
" end local authors = meta.author if authors and pandoc.utils.type(authors) ~= "List" then authors = { authors } end for _, a in ipairs(authors or {}) do html[#html + 1] = '" end if meta.date then html[#html + 1] = '' .. esc(pandoc.utils.stringify(meta.date)) .. "
" end html[#html + 1] = "