From eb3a1b11d141f0e24965ef96ff31b70d4dabb9e5 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 8 Dec 2023 22:07:12 -0800 Subject: Typst reader: change cite (only one key allowed, a label). This is a typst 0.9 breaking change. --- src/Text/Pandoc/Readers/Typst.hs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/Text') 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) -- cgit v1.2.3