aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-08-16 18:59:46 -0700
committerJohn MacFarlane <[email protected]>2025-08-17 17:45:36 +0200
commitf1404e2d2fd4e389ada4ba34b8fca521f612b368 (patch)
tree1743e74a1339faf1b5380e41110cdb2b809832e8 /src
parente0160fbc23ac12eb17edc32f9e945fa4f1c62c01 (diff)
LaTeX writer: add braces around comments in title-meta.
This is needed to prevent PDFs from interpreting this as a sequence of titles. See #10501.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 9f5f6ed69..2c71e689a 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -179,7 +179,8 @@ pandocToLaTeX options (Pandoc meta blocks) = do
main <- blockListToLaTeX blocks'''
biblioTitle <- inlineListToLaTeX lastHeader
st <- get
- titleMeta <- stringToLaTeX TextString $ stringify $ docTitle meta
+ titleMeta <- escapeCommas <$> -- see #10501
+ stringToLaTeX TextString (stringify $ docTitle meta)
authorsMeta <- mapM (stringToLaTeX TextString . stringify) $ docAuthors meta
-- The trailer ID is as hash used to identify the PDF. Taking control of its
-- value is important when aiming for reproducible PDF generation. Setting
@@ -301,6 +302,10 @@ pandocToLaTeX options (Pandoc meta blocks) = do
Nothing -> main
Just tpl -> renderTemplate tpl context'
+-- Commas in title-meta need to be put in braces; see #10501
+escapeCommas :: Text -> Text
+escapeCommas = T.replace "," "{,}"
+
toSlides :: PandocMonad m => [Block] -> LW m [Block]
toSlides bs = do
opts <- gets stOptions