summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/typst-library/src/layout/mod.rs1
-rw-r--r--tests/ref/meta/bibliography-ordering.pngbin140198 -> 155039 bytes
-rw-r--r--tests/ref/meta/bibliography.pngbin118312 -> 118033 bytes
-rw-r--r--tests/ref/meta/cite-group.pngbin0 -> 16597 bytes
-rw-r--r--tests/typ/meta/bibliography-ordering.typ15
-rw-r--r--tests/typ/meta/cite-group.typ19
6 files changed, 32 insertions, 3 deletions
diff --git a/crates/typst-library/src/layout/mod.rs b/crates/typst-library/src/layout/mod.rs
index 2ff4c928..1c7c2610 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::<CiteElem>() {
+ self.staged.retain(|(elem, _)| !elem.is::<SpaceElem>());
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 675d2f68..d1be5ddf 100644
--- a/tests/ref/meta/bibliography-ordering.png
+++ b/tests/ref/meta/bibliography-ordering.png
Binary files differ
diff --git a/tests/ref/meta/bibliography.png b/tests/ref/meta/bibliography.png
index cb00f896..ed3dd667 100644
--- a/tests/ref/meta/bibliography.png
+++ b/tests/ref/meta/bibliography.png
Binary files differ
diff --git a/tests/ref/meta/cite-group.png b/tests/ref/meta/cite-group.png
new file mode 100644
index 00000000..ade98093
--- /dev/null
+++ b/tests/ref/meta/cite-group.png
Binary files differ
diff --git a/tests/typ/meta/bibliography-ordering.typ b/tests/typ/meta/bibliography-ordering.typ
index 5a00c51e..970d66d0 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 00000000..3bb0046d
--- /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")