Skip to content

Commit

Permalink
fix(footnotes): fix missing footnotes and footnote marker
Browse files Browse the repository at this point in the history
  • Loading branch information
no-vici committed Jan 23, 2025
1 parent 50a5956 commit 47e73c7
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions packages/parallel/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ function FootnoteManager:add(frame, note)
end

-- Get footnotes for a specific frame
-- function FootnoteManager:get(frame)
-- return self.frames[frame]
-- end
function FootnoteManager:get(frame)
return self.frames[frame]
end

-- Iterate over footnotes for a specific frame
function FootnoteManager:processNotes(frame, callback)
Expand Down Expand Up @@ -300,8 +300,6 @@ function FootnoteManager:typesetFootnotes()
else
log("No footnotes to process for frame: " .. frame)
end
-- Flush footnote frames
footnoteManager:clear(frame)
end
end

Expand Down Expand Up @@ -330,14 +328,14 @@ local parallelPagebreak = function()

if #linesToFit > 0 then
hasOverflow = true
overflowContent[frame] = linesToFit
-- overflowContent[frame] = pl.tablex.copy(linesToFit)
-- overflowContent[frame] = linesToFit
overflowContent[frame] = pl.tablex.copy(linesToFit)
-- Reset output queue to avoid double processing
typesetter.state.outputQueue = {}
else
overflowContent[frame] = {}
end

-- Typeset this page
typesetter:outputLinesToPage(thispage)
end)

Expand Down Expand Up @@ -578,12 +576,13 @@ function package:registerCommands()
local targetFrame = currentFrame == "a" and "ftn_left" or "ftn_right"

-- Increment or retrieve the footnote counter for the target frame
local footnoteNumber
local footnoteNumber, marker
if not options.mark then
SILE.call("increment-counter", { id = targetFrame })
footnoteNumber = self.class.packages.counters:formatCounter(SILE.scratch.counters[targetFrame])
marker = tostring(footnoteNumber) .. "."
else
footnoteNumber = options.mark
marker = options.mark
end

-- Add the footnote marker to the text
Expand All @@ -593,7 +592,7 @@ function package:registerCommands()

-- Add the footnote to the manager
footnoteManager:add(targetFrame, {
marker = tostring(footnoteNumber) .. ".",
marker = marker,
content = content,
})
end)
Expand Down

0 comments on commit 47e73c7

Please sign in to comment.