From a6a5be132a5aa53f9744850f33a52e25aecf2628 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 12 Aug 2025 22:42:54 -0700 Subject: Typst writer: add parens around typst-native year-only citations. Closes #11044. --- src/Text/Pandoc/Writers/Typst.hs | 5 ++++- test/command/9452.md | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Text/Pandoc/Writers/Typst.hs b/src/Text/Pandoc/Writers/Typst.hs index 7fd7e1cf6..a5cdbc483 100644 --- a/src/Text/Pandoc/Writers/Typst.hs +++ b/src/Text/Pandoc/Writers/Typst.hs @@ -617,7 +617,10 @@ toCite cite = do [] -> pure mempty suff -> (", supplement: " <>) . brackets <$> inlinesToTypst (eatComma suff) - pure $ "#cite" <> parens (label <> form <> suppl) <> endCode + pure $ (if citationMode cite == SuppressAuthor -- see #11044 + then parens + else id) + $ "#cite" <> parens (label <> form <> suppl) <> endCode doubleQuoted :: Text -> Doc Text doubleQuoted = doubleQuotes . literal . escape diff --git a/test/command/9452.md b/test/command/9452.md index 12143d6e5..b3d60fca9 100644 --- a/test/command/9452.md +++ b/test/command/9452.md @@ -14,6 +14,6 @@ Here is a sentence @something2024. With supplement @something2024[p.~3]. -And just the year #cite(, form: "year");. +And just the year (#cite(, form: "year");). ``` -- cgit v1.2.3