Skip to content

Commit

Permalink
fix: no error '! Couldn't find frame ID folio' anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
jodros committed Dec 26, 2023
1 parent 84771ae commit a2a59b8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/folio/init.lua
Original file line number Diff line number Diff line change
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 a2a59b8

Please sign in to comment.