aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2023-12-08 22:07:12 -0800
committerJohn MacFarlane <[email protected]>2023-12-08 22:07:12 -0800
commiteb3a1b11d141f0e24965ef96ff31b70d4dabb9e5 (patch)
treedc48f30d380f1a26fc9332b55694ca3589127176
parentd57f3d576e505c805e8aa727b588235558c9abf3 (diff)
Typst reader: change cite (only one key allowed, a label).
This is a typst 0.9 breaking change.
-rw-r--r--src/Text/Pandoc/Readers/Typst.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Typst.hs b/src/Text/Pandoc/Readers/Typst.hs
index b440884ca..ef83360e0 100644
--- a/src/Text/Pandoc/Readers/Typst.hs
+++ b/src/Text/Pandoc/Readers/Typst.hs
@@ -400,18 +400,20 @@ inlineHandlers = M.fromList
,("footnote", \_ fields ->
B.note <$> (getField "body" fields >>= pWithContents pBlocks))
,("cite", \_ fields -> do
- keys <- V.toList <$> getField "keys" fields
- let toCitation key =
+ key <- getField "key" fields
+ (form :: Text) <- getField "form" fields <|> pure "normal"
+ let citation =
B.Citation
{ B.citationId = key,
B.citationPrefix = mempty,
B.citationSuffix = mempty,
- B.citationMode = B.NormalCitation,
+ B.citationMode = case form of
+ "year" -> B.SuppressAuthor
+ _ -> B.NormalCitation,
B.citationNoteNum = 0,
B.citationHash = 0
}
- let citations = map toCitation keys
- pure $ B.cite citations (B.text $ "[" <> T.intercalate "," keys <> "]"))
+ pure $ B.cite [citation] (B.text $ "[" <> key <> "]"))
,("lower", \_ fields -> do
body <- getField "text" fields
walk (modString T.toLower) <$> pWithContents pInlines body)