aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-01-22 21:28:46 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-01-22 21:28:46 +0000
commit8f0750574ac1702d27bf9a98ccce3962ad0b587c (patch)
tree0d0ae7cedbd53d157172177fd1233ef6a2457c4f /src/Text/Pandoc/Writers
parenta7839a18a785e5fe407fdc8906af8d220469f7a4 (diff)
downloadpandoc-8f0750574ac1702d27bf9a98ccce3962ad0b587c.tar.gz
+ Added a 'substitute' function to Shared.hs. This is a generic
list function that can be used to substitute one substring for another in a string, like 'gsub' except without regular expressions. + Use 'substitute' instead of 'gsub' in the LaTeX writer. This avoids what appears to be a bug in Text.Regex, whereby "\\^" matches "\350". There seems to be a slight speed improvement as well. (Note: If this works, it would be good to replace other uses of gsub that don't employ regexs with 'substitute'.) git-svn-id: https://pandoc.googlecode.com/svn/trunk@500 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index db7af223d..2badf2f24 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -78,12 +78,12 @@ latexHeader notes options (Meta title authors date) =
escapeBrackets = backslashEscape "{}"
escapeSpecial = backslashEscape "$%&~_#"
-escapeBackslash = gsub "\\\\" "\\\\textbackslash{}"
-fixBackslash = gsub "\\\\textbackslash\\\\\\{\\\\\\}" "\\\\textbackslash{}"
-escapeHat = gsub "\\^" "\\\\^{}"
-escapeBar = gsub "\\|" "\\\\textbar{}"
-escapeLt = gsub "<" "\\\\textless{}"
-escapeGt = gsub ">" "\\\\textgreater{}"
+escapeBackslash = substitute "\\" "\\textbackslash{}"
+fixBackslash = substitute "\\textbackslash\\{\\}" "\\textbackslash{}"
+escapeHat = substitute "^" "\\^{}"
+escapeBar = substitute "|" "\\textbar{}"
+escapeLt = substitute "<" "\\textless{}"
+escapeGt = substitute ">" "\\textgreater{}"
-- | Escape string for LaTeX
stringToLaTeX :: String -> String