diff options
| -rw-r--r-- | data/templates/default.typst | 10 | ||||
| -rw-r--r-- | data/templates/template.typst | 13 | ||||
| -rw-r--r-- | test/writer.typst | 19 |
3 files changed, 32 insertions, 10 deletions
diff --git a/data/templates/default.typst b/data/templates/default.typst index 37e8a6247..c5e602e4a 100644 --- a/data/templates/default.typst +++ b/data/templates/default.typst @@ -31,11 +31,11 @@ $if(author)$ authors: ( $for(author)$ $if(author.name)$ - ( name: "$author.name$", - affiliation: "$author.affiliation$", - email: "$author.email$" ), + ( name: [$author.name$], + affiliation: [$author.affiliation$], + email: [$author.email$] ), $else$ - ( name: "$author$", + ( name: [$author$], affiliation: "", email: "" ), $endif$ @@ -46,7 +46,7 @@ $if(keywords)$ keywords: ($for(keywords)$$keyword$$sep$,$endfor$), $endif$ $if(date)$ - date: "$date$", + date: [$date$], $endif$ $if(lang)$ lang: "$lang$", diff --git a/data/templates/template.typst b/data/templates/template.typst index 8672647be..02f15cbfc 100644 --- a/data/templates/template.typst +++ b/data/templates/template.typst @@ -1,3 +1,14 @@ +#let content-to-string(content) = { + if content.has("text") { + content.text + } else if content.has("children") { + content.children.map(to-string).join("") + } else if content.has("body") { + content-to-string(content.body) + } else if content == [ ] { + " " + } +} #let conf( title: none, subtitle: none, @@ -17,7 +28,7 @@ ) = { set document( title: title, - author: authors.map(author => author.name), + author: authors.map(author => content-to-string(author.name)), keywords: keywords, ) set page( diff --git a/test/writer.typst b/test/writer.typst index 3e21fb7a8..a2ac4025e 100644 --- a/test/writer.typst +++ b/test/writer.typst @@ -20,6 +20,17 @@ stroke: none ) +#let content-to-string(content) = { + if content.has("text") { + content.text + } else if content.has("children") { + content.children.map(to-string).join("") + } else if content.has("body") { + content-to-string(content.body) + } else if content == [ ] { + " " + } +} #let conf( title: none, subtitle: none, @@ -39,7 +50,7 @@ ) = { set document( title: title, - author: authors.map(author => author.name), + author: authors.map(author => content-to-string(author.name)), keywords: keywords, ) set page( @@ -101,14 +112,14 @@ #show: doc => conf( title: [Pandoc Test Suite], authors: ( - ( name: "John MacFarlane", + ( name: [John MacFarlane], affiliation: "", email: "" ), - ( name: "Anonymous", + ( name: [Anonymous], affiliation: "", email: "" ), ), - date: "July 17, 2006", + date: [July 17, 2006], cols: 1, doc, ) |
