aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-09-01 10:11:09 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-09-01 10:11:09 -0700
commitcb1a8da01c5ff98d8e2bc64efb1c401c1cf0dc82 (patch)
tree2a440b2aa5c6e04956299435c8070cca691ce57d /src
parent43ebb0229ffb96895b54e49447eabbea66c4f0f8 (diff)
downloadpandoc-cb1a8da01c5ff98d8e2bc64efb1c401c1cf0dc82.tar.gz
LaTeX writer: Avoid using reserved characters as \lstinline delimiters.
Closes #1595.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 8e3befe19..3596b75e9 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -731,7 +731,9 @@ inlineToLaTeX (Code (_,classes,_) str) = do
where listingsCode = do
inNote <- gets stInNote
when inNote $ modify $ \s -> s{ stVerbInNote = True }
- let chr = ((enumFromTo '!' '~') \\ str) !! 0
+ let chr = case "!\"&'()*,-./:;?@_" \\ str of
+ (c:_) -> c
+ [] -> '!'
return $ text $ "\\lstinline" ++ [chr] ++ str ++ [chr]
highlightCode = do
case highlight formatLaTeXInline ("",classes,[]) str of