From b3d721b4ab28a9aea3447db9e51968ca9434f175 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 3 Sep 2024 20:14:33 -0700 Subject: [PATCH] Typst writer: don't include trailing semicolon after... `@` style citations with suffixes. Closes #10148. --- src/Text/Pandoc/Writers/Typst.hs | 3 +-- test/command/10148.md | 18 ++++++++++++++++++ test/command/9452.md | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 test/command/10148.md diff --git a/src/Text/Pandoc/Writers/Typst.hs b/src/Text/Pandoc/Writers/Typst.hs index 9344c6f40b1f..b4e8d20a4c31 100644 --- a/src/Text/Pandoc/Writers/Typst.hs +++ b/src/Text/Pandoc/Writers/Typst.hs @@ -517,8 +517,7 @@ toCite cite = do then do suppl <- case citationSuffix cite of [] -> pure mempty - suff -> (<> endCode) . brackets - <$> inlinesToTypst (eatComma suff) + suff -> brackets <$> inlinesToTypst (eatComma suff) pure $ "@" <> literal ident' <> suppl else do let label = if T.all isIdentChar ident' diff --git a/test/command/10148.md b/test/command/10148.md new file mode 100644 index 000000000000..c90f6d0b5634 --- /dev/null +++ b/test/command/10148.md @@ -0,0 +1,18 @@ +``` +% pandoc -t typst +See [@MyPaper]. + +See [@MyPaper, Equation 1] for details. + +See [@MyPaper, Equation 1]. + +See [@MyPaper, Equation 1; @Other, Figure 1]. +^D +See @MyPaper. + +See @MyPaper[Equation 1] for details. + +See @MyPaper[Equation 1]. + +See @MyPaper[Equation 1]@Other[Figure 1]. +``` diff --git a/test/command/9452.md b/test/command/9452.md index 2d89921b9f04..12143d6e5208 100644 --- a/test/command/9452.md +++ b/test/command/9452.md @@ -12,7 +12,7 @@ And just the year [-@something2024]. Here is a sentence @something2024. -With supplement @something2024[p.~3];. +With supplement @something2024[p.~3]. And just the year #cite(, form: "year");.