aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-08-12 22:42:54 -0700
committerJohn MacFarlane <[email protected]>2025-08-12 22:43:27 -0700
commita6a5be132a5aa53f9744850f33a52e25aecf2628 (patch)
tree6ee84e998237464bd2b70e38ef9c35cd03ed3bcd
parenta36654b22286c0459fb4d7d354c865da23d6061f (diff)
Typst writer: add parens around typst-native year-only citations.
Closes #11044.
-rw-r--r--src/Text/Pandoc/Writers/Typst.hs5
-rw-r--r--test/command/9452.md2
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(<something2024>, form: "year");.
+And just the year (#cite(<something2024>, form: "year");).
```