Skip to content

Commit

Permalink
Merge a2a59b8 into 84771ae
Browse files Browse the repository at this point in the history
  • Loading branch information
jodros committed Dec 26, 2023
2 parents 84771ae + a2a59b8 commit 0e5efba
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/folio/init.lua
Expand Up @@ -18,8 +18,9 @@ function package:outputFolio (frame)
SILE.scratch.counters.folio.off = false
end
else
local folioFrame = SILE.getFrame(frame)
if (folioFrame) then
local success, folioFrame = pcall(SILE.getFrame(frame))
isfolioframe = success
if success then
SILE.typesetNaturally(folioFrame, function ()
SILE.settings:pushState()
-- Restore the settings to the top of the queue, which should be the document #986
Expand Down Expand Up @@ -48,7 +49,7 @@ function package:_init (options)
self:loadPackage("counters")
SILE.scratch.counters.folio = { value = 1, display = "arabic" }
self.class:registerHook("newpage", function() self:incrementFolio() end)
self.class:registerHook("endpage", function () self:outputFolio(options and options.frame) end)
self.class:registerHook("endpage", function () if isfolioframe then self:outputFolio(options and options.frame) end end)
self:export("outputFolio", self.outputFolio)
end

Expand Down

0 comments on commit 0e5efba

Please sign in to comment.