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

fix: Running headers could be incorrectly reset #110

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions classes/resilient/book.lua
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,16 @@ function class:registerCommands ()
-- Parts cancel headers and folios
SILE.call("noheaderthispage")
SILE.call("nofoliothispage")
-- Previous section titles (in technical mode) or chapter title (in novel mode)
-- is no longer valid (and in none mode, it's not valid anyway).
SILE.scratch.headers.odd = nil
SILE.scratch.headers.even = nil

if self.headers == "technical" then
-- In novel mode, the book title is in the even header, and is still valid
-- So we don't reset it.
-- But in technical mode, even headers contain the current chapter title,
-- invalid upon a new part.
SILE.scratch.headers.even = nil
end
-- Parts reset footnotes and chapters
SILE.call("set-counter", { id = "footnote", value = 1 })
SILE.call("set-multilevel-counter", { id = "sections", level = 1, value = 0 })
Expand All @@ -549,6 +556,9 @@ function class:registerCommands ()
SILE.call("odd-tracked-header", {}, content)
elseif self.headers == "technical" then
SILE.call("even-tracked-header", {}, content)
-- In technical mode, the odd header contains a section title, and is
-- no longer valid upon a new chapter.
SILE.scratch.headers.odd = nil
end
end
end, "Apply chapter hooks (counter resets, footers and headers, etc.)")
Expand Down