diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-08-16 12:53:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-16 10:53:12 +0000 |
| commit | d97d71948ebadebe87341649eeb4aae69c746ae1 (patch) | |
| tree | 360b51c938b5187928797ffe6148116bf018b22b /tests/suite | |
| parent | feb0c913954d385a3f906f9d9d8ec33cbcf2b2d0 (diff) | |
Fix document set rules (#4768)
Diffstat (limited to 'tests/suite')
| -rw-r--r-- | tests/suite/model/document.typ | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/tests/suite/model/document.typ b/tests/suite/model/document.typ index 6f8e7131..2ed199fe 100644 --- a/tests/suite/model/document.typ +++ b/tests/suite/model/document.typ @@ -1,12 +1,10 @@ // Test document and page-level styles. --- document-set-title --- -// This is okay. #set document(title: [Hello]) What's up? --- document-set-author-date --- -// This, too. #set document(author: ("A", "B"), date: datetime.today()) --- document-date-bad --- @@ -14,15 +12,14 @@ What's up? #set document(date: "today") --- document-author-bad --- -// This, too. // Error: 23-29 expected string, found integer #set document(author: (123,)) What's up? --- document-set-after-content --- +// Document set rules can appear anywhere in top-level realization, also after +// content. Hello - -// Error: 2-30 document set rules must appear before any content #set document(title: [Hello]) --- document-constructor --- @@ -34,3 +31,24 @@ Hello // Error: 4-32 document set rules are not allowed inside of containers #set document(title: [Hello]) ] + +--- issue-4065-document-context --- +// Test that we can set document properties based on context. +#show: body => context { + let all = query(heading) + let title = if all.len() > 0 { all.first().body } + set document(title: title) + body +} + +#show heading: none += Top level + +--- issue-4769-document-context-conditional --- +// Test that document set rule can be conditional on document information +// itself. +#set document(author: "Normal", title: "Alternative") +#context { + set document(author: "Changed") if "Normal" in document.author + set document(title: "Changed") if document.title == "Normal" +} |
