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

Overhaul counters in insertions #1032

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
17 changes: 9 additions & 8 deletions classes/book.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,21 @@ book.init = function (self)
end

book.newPage = function (self)
book:switchPage()
book:newPageInfo()
self:switchPage()
self:newPageInfo()
return plain.newPage(self)
end

book.finish = function ()
book.finish = function (self)
local ret = plain.finish(book)
book:writeToc()
self:writeToc()
return ret
end

book.endPage = function (_)
book:moveTocNodes()
book.endPage = function (self)
self:moveTocNodes()

if (book:oddPage() and SILE.scratch.headers.right) then
if (self:oddPage() and SILE.scratch.headers.right) then
SILE.typesetNaturally(SILE.getFrame("runningHead"), function ()
SILE.settings.set("current.parindent", SILE.nodefactory.glue())
SILE.settings.set("document.lskip", SILE.nodefactory.glue())
Expand All @@ -70,7 +70,7 @@ book.endPage = function (_)
SILE.process(SILE.scratch.headers.right)
SILE.call("par")
end)
elseif (not(book:oddPage()) and SILE.scratch.headers.left) then
elseif (not(self:oddPage()) and SILE.scratch.headers.left) then
SILE.typesetNaturally(SILE.getFrame("runningHead"), function ()
SILE.settings.set("current.parindent", SILE.nodefactory.glue())
SILE.settings.set("document.lskip", SILE.nodefactory.glue())
Expand Down Expand Up @@ -212,6 +212,7 @@ SILE.registerCommand("book:chapterfont", function (_, content)
SILE.call("font", { weight = 800, size = "22pt" }, content)
end)
end)

SILE.registerCommand("book:sectionfont", function (_, content)
SILE.settings.temporarily(function ()
SILE.call("font", { weight = 800, size = "15pt" }, content)
Expand Down
21 changes: 21 additions & 0 deletions tests/bug-1018.sil
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
\begin[papersize=a6,class=book]{document}
\nofolios
\script[src=packages/lorem]
% \script[src=packages/debug]
% \disable-pushback
\define[command=foo]{\bar \bar \bar \bar \bar \bar \bar\par}
\define[command=bar]{\lorem[words=3]\footnote{\lorem[words=5]}}
\begin{script}
local _newPage = SILE.documentState.documentClass.newPage
SILE.documentState.documentClass.newPage = function (self)
local ret = _newPage(self)
SILE.call("set-counter", { id = "footnote", value = 1 })
return ret
end
\end{script}
\foo
\foo
\foo
\foo
\foo
\end{document}