summaryrefslogtreecommitdiff
path: root/crates/typst-layout
diff options
context:
space:
mode:
authorPgBiel <9021226+PgBiel@users.noreply.github.com>2024-12-08 13:35:54 -0300
committerGitHub <noreply@github.com>2024-12-08 16:35:54 +0000
commit62567fc91e2d58d5d12457bbeddc5d7950d7c570 (patch)
treedd16f50721ad30014e5889a888fa983255710f16 /crates/typst-layout
parente6de044b1da1e1c801a69149d757bada7154a83b (diff)
Fix multiple footnotes in footnote entry (#5545)
Diffstat (limited to 'crates/typst-layout')
-rw-r--r--crates/typst-layout/src/flow/compose.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/crates/typst-layout/src/flow/compose.rs b/crates/typst-layout/src/flow/compose.rs
index 343b4783..9650a7bc 100644
--- a/crates/typst-layout/src/flow/compose.rs
+++ b/crates/typst-layout/src/flow/compose.rs
@@ -470,7 +470,20 @@ impl<'a, 'b> Composer<'a, 'b, '_, '_> {
// Lay out nested footnotes.
for (_, note) in nested {
- self.footnote(note, regions, flow_need, migratable)?;
+ match self.footnote(note, regions, flow_need, migratable) {
+ // This footnote was already processed or queued.
+ Ok(_) => {}
+ // Footnotes always request a relayout when processed for the
+ // first time, so we ignore a relayout request since we're
+ // about to do so afterwards. Without this check, the first
+ // inner footnote interrupts processing of the following ones.
+ Err(Stop::Relayout(_)) => {}
+ // Either of
+ // - A `Stop::Finish` indicating that the frame's origin element
+ // should migrate to uphold the footnote invariant.
+ // - A fatal error.
+ err => return err,
+ }
}
// Since we laid out a footnote, we need a relayout.