diff options
author | John MacFarlane <jgm@berkeley.edu> | 2020-10-13 20:53:39 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2020-10-13 20:53:39 -0700 |
commit | a55fb5f29d3772981adfc494c2597f0a1b8bdb64 (patch) | |
tree | fad7d8e32cbc6b6f1ce3d6da5ae24a91e1a5bc7b /src/Text/Pandoc/Writers | |
parent | 229e763646f2d743c03972a4118f542dbe0580cb (diff) | |
download | pandoc-a55fb5f29d3772981adfc494c2597f0a1b8bdb64.tar.gz |
LaTeX writer: escape option values in lstlistings environment.
Closes #6742.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index f7342f6e1..965395d7c 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -635,6 +635,7 @@ blockToLaTeX (CodeBlock (identifier,classes,keyvalAttr) str) = do let listingsCodeBlock = do st <- get ref <- toLabel identifier + let esc = escapeStringUsing (backslashEscapes "\\{}%~_&#^") let params = if writerListings (stOptions st) then (case getListingsLanguage classes of Just l -> [ "language=" <> mbBraced l ] @@ -644,7 +645,7 @@ blockToLaTeX (CodeBlock (identifier,classes,keyvalAttr) str) = do || "number-lines" `elem` classes ] ++ [ (if key == "startFrom" then "firstnumber" - else key) <> "=" <> mbBraced attr | + else key) <> "=" <> mbBraced (esc attr) | (key,attr) <- keyvalAttr, key `notElem` ["exports", "tangle", "results"] -- see #4889 |