aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2023-12-10 23:48:00 -0800
committerJohn MacFarlane <[email protected]>2023-12-11 10:18:37 -0800
commitea9317c73d508d0ce7993db66edb239a3e968cdb (patch)
tree85d41568c6067b02f6d202fe8e9dcf41929d1d6b
parent3039f99f3b4146312d4c4697f56f0d614b0e8249 (diff)
Typst template fixes.
-rw-r--r--data/templates/default.typst17
-rw-r--r--data/templates/template.typst10
-rw-r--r--test/writer.typst24
3 files changed, 33 insertions, 18 deletions
diff --git a/data/templates/default.typst b/data/templates/default.typst
index 55864de92..935ae602c 100644
--- a/data/templates/default.typst
+++ b/data/templates/default.typst
@@ -23,19 +23,22 @@ $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$],
- affiliation: [],
- email: [] ),
+ ( name: "$author$",
+ affiliation: "",
+ email: "" ),
$endif$
$endfor$
),
$endif$
+$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 009968ba3..e1ac3ec37 100644
--- a/data/templates/template.typst
+++ b/data/templates/template.typst
@@ -1,6 +1,7 @@
#let conf(
title: none,
- authors: none,
+ authors: (),
+ keywords: (),
date: none,
abstract: none,
cols: 1,
@@ -13,6 +14,11 @@
sectionnumbering: none,
doc,
) = {
+ set document(
+ title: title,
+ author: authors.map(author => author.name),
+ keywords: keywords,
+ )
set page(
paper: paper,
margin: margin,
@@ -31,7 +37,7 @@
]]
}
- if authors != none {
+ if authors != none and authors != [] {
let count = authors.len()
let ncols = calc.min(count, 3)
grid(
diff --git a/test/writer.typst b/test/writer.typst
index d4dd4c8e6..a0f062b79 100644
--- a/test/writer.typst
+++ b/test/writer.typst
@@ -17,7 +17,8 @@
#let conf(
title: none,
- authors: none,
+ authors: (),
+ keywords: (),
date: none,
abstract: none,
cols: 1,
@@ -30,6 +31,11 @@
sectionnumbering: none,
doc,
) = {
+ set document(
+ title: title,
+ author: authors.map(author => author.name),
+ keywords: keywords,
+ )
set page(
paper: paper,
margin: margin,
@@ -48,7 +54,7 @@
]]
}
- if authors != none {
+ if authors != none and authors != [] {
let count = authors.len()
let ncols = calc.min(count, 3)
grid(
@@ -85,14 +91,14 @@
#show: doc => conf(
title: [Pandoc Test Suite],
authors: (
- ( name: [John MacFarlane],
- affiliation: [],
- email: [] ),
- ( name: [Anonymous],
- affiliation: [],
- email: [] ),
+ ( name: "John MacFarlane",
+ affiliation: "",
+ email: "" ),
+ ( name: "Anonymous",
+ affiliation: "",
+ email: "" ),
),
- date: [July 17, 2006],
+ date: "July 17, 2006",
cols: 1,
doc,
)