summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-02-12 13:23:48 +0100
committerLaurenz <laurmaedje@gmail.com>2023-02-12 13:23:48 +0100
commit2b26e0812877b5a42b62c4bfc8b63a8e61283bff (patch)
tree4493c7b91562a13a5d8af0ee48d2cf1ac0e4b3a6
parent8cbc2ac4832d659255e6f509ef6db66c69bda918 (diff)
Fix set document bug
-rw-r--r--library/src/layout/mod.rs7
-rw-r--r--tests/ref/meta/document.pngbin68 -> 991 bytes
-rw-r--r--tests/typ/meta/document.typ2
3 files changed, 5 insertions, 4 deletions
diff --git a/library/src/layout/mod.rs b/library/src/layout/mod.rs
index 7f395545..6c01759c 100644
--- a/library/src/layout/mod.rs
+++ b/library/src/layout/mod.rs
@@ -433,9 +433,10 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> {
if self.doc.is_none() {
bail!(span, "not allowed here");
}
- if !self.flow.0.is_empty()
- || !self.par.0.is_empty()
- || !self.list.items.is_empty()
+ if styles.is_none()
+ && (!self.flow.0.is_empty()
+ || !self.par.0.is_empty()
+ || !self.list.items.is_empty())
{
bail!(span, "must appear before any content");
}
diff --git a/tests/ref/meta/document.png b/tests/ref/meta/document.png
index bc0a95bf..aa3da163 100644
--- a/tests/ref/meta/document.png
+++ b/tests/ref/meta/document.png
Binary files differ
diff --git a/tests/typ/meta/document.typ b/tests/typ/meta/document.typ
index bbe8dafa..e8d53650 100644
--- a/tests/typ/meta/document.typ
+++ b/tests/typ/meta/document.typ
@@ -2,8 +2,8 @@
---
// This is okay.
-// Ref: false
#set document(title: "Hello")
+What's up?
---
Hello