Add a way to short-circuit renders part way through
Opened this issue · 1 comments
Something I find myself doing on a lot of projects towards the end of typesetting the rest of a book is working on the TOC design. One way to quickly iterate on this is to truncate the content temporarily to get really fast re-renders of the TOC. The problem then becomes how to get the full TOC content in the next render pass.
One solution is to stash the .toc
file and restore it between builds of the truncated content.
Another is to disable writing the TOC file, but this is more complex that one would think because the hook is cached, e.g. in a project package:
function package:_init()
self.class:registerPostinit(function ()
if self.class.packages.tableofcontents then
local writeToc = self.class.packages.tableofcontents.writeToc
self.class.packages.tableofcontents.writeToc = function () end
for i, func in ipairs(self.class.hooks.finish) do
if func == writeToc then
self.class.hooks.finish[i] = nil
end
end
end
end)
end
It should be easier to build a document to a certain page number and then stop having output all the rendering to date without nuking the .toc
file or other artifacts from previous builds. This means triggering the hooks to finalize the PDF but not output any other meta data.
towards the end of typesetting the rest of a book is working on the TOC design.
Funny fact: this is one of the first thing I do (i.e. styling decisions) when it comes to a making new book (before chapters are even known and composed).
But I 'm not using the regular ToC package (read: I'm either using my resilient.tableofcontents or my fancytoc), and my actual short-circuit exists here too (placeholders in my master document system, rather than actual chapters).
Anyhow, I am not sure how it relates to the book class (?)