Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to short-circuit renders part way through #2108

Open
alerque opened this issue Sep 14, 2024 · 2 comments
Open

Add a way to short-circuit renders part way through #2108

alerque opened this issue Sep 14, 2024 · 2 comments
Labels
enhancement Software improvement or feature request

Comments

@alerque
Copy link
Member

alerque commented Sep 14, 2024

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.

@alerque alerque added the enhancement Software improvement or feature request label Sep 14, 2024
@Omikhleia
Copy link
Member

Omikhleia commented Sep 14, 2024

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 (?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Software improvement or feature request
Projects
None yet
Development

No branches or pull requests

3 participants
@alerque @Omikhleia and others