diff --git a/crates/typst-library/src/layout/mod.rs b/crates/typst-library/src/layout/mod.rs index 2ff4c9284..1c7c26103 100644 --- a/crates/typst-library/src/layout/mod.rs +++ b/crates/typst-library/src/layout/mod.rs @@ -755,6 +755,7 @@ impl<'a> CiteGroupBuilder<'a> { } if let Some(citation) = content.to::() { + self.staged.retain(|(elem, _)| !elem.is::()); self.items.push(citation.clone(), styles); return true; } diff --git a/tests/ref/meta/bibliography-ordering.png b/tests/ref/meta/bibliography-ordering.png index 675d2f68e..d1be5ddf7 100644 Binary files a/tests/ref/meta/bibliography-ordering.png and b/tests/ref/meta/bibliography-ordering.png differ diff --git a/tests/ref/meta/bibliography.png b/tests/ref/meta/bibliography.png index cb00f8968..ed3dd6677 100644 Binary files a/tests/ref/meta/bibliography.png and b/tests/ref/meta/bibliography.png differ diff --git a/tests/ref/meta/cite-group.png b/tests/ref/meta/cite-group.png new file mode 100644 index 000000000..ade980935 Binary files /dev/null and b/tests/ref/meta/cite-group.png differ diff --git a/tests/typ/meta/bibliography-ordering.typ b/tests/typ/meta/bibliography-ordering.typ index 5a00c51e1..970d66d0e 100644 --- a/tests/typ/meta/bibliography-ordering.typ +++ b/tests/typ/meta/bibliography-ordering.typ @@ -1,7 +1,16 @@ #set page(width: 300pt) -@mcintosh_anxiety, @psychology25 -@netwok, @issue201, @arrgh, @quark, @distress, -@glacier-melt, @issue201, @tolkien54, @sharing, @restful +@mcintosh_anxiety +@psychology25 +@netwok +@issue201 +@arrgh +@quark +@distress, +@glacier-melt +@issue201 +@tolkien54 +@sharing +@restful #bibliography("/files/works.bib") diff --git a/tests/typ/meta/cite-group.typ b/tests/typ/meta/cite-group.typ new file mode 100644 index 000000000..3bb0046d1 --- /dev/null +++ b/tests/typ/meta/cite-group.typ @@ -0,0 +1,19 @@ +// Test citation grouping. + +--- +A#[@netwok@arrgh]B \ +A@netwok@arrgh B \ +A@netwok @arrgh B \ +A@netwok @arrgh. B \ + +A @netwok#[@arrgh]B \ +A @netwok@arrgh, B \ +A @netwok @arrgh, B \ +A @netwok @arrgh. B \ + +A#[@netwok @arrgh @quark]B. \ +A @netwok @arrgh @quark B. \ +A @netwok @arrgh @quark, B. + +#set text(0pt) +#bibliography("/files/works.bib")