diff options
author | John MacFarlane <jgm@berkeley.edu> | 2010-10-24 19:31:06 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2010-10-24 19:38:16 -0700 |
commit | 7e9e959548e665773f7eed388c79ff89d2469d24 (patch) | |
tree | 216a685f4ef83793818a49330b7c5d3e35edce3a /src/Text/Pandoc | |
parent | 220a20bf9288bd44642038e5737c933d2b281306 (diff) | |
download | pandoc-7e9e959548e665773f7eed388c79ff89d2469d24.tar.gz |
LaTeX & ConTeXt writers: escape [ and ] as {[} and {]}.
This avoids unwanted interpretation as optional arguments
in some contexts, which caused the brackets to silently
disappear!
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Writers/ConTeXt.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs index 395bc2d30..a3a30f0a0 100644 --- a/src/Text/Pandoc/Writers/ConTeXt.hs +++ b/src/Text/Pandoc/Writers/ConTeXt.hs @@ -92,6 +92,8 @@ escapeCharForConTeXt ch = '#' -> "\\#" '<' -> "\\letterless{}" '>' -> "\\lettermore{}" + '[' -> "{[}" + ']' -> "{]}" '_' -> "\\letterunderscore{}" '\160' -> "~" x -> [x] diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 720c00ac8..5fa345760 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -107,6 +107,8 @@ stringToLaTeX = escapeStringUsing latexEscapes , ('|', "\\textbar{}") , ('<', "\\textless{}") , ('>', "\\textgreater{}") + , ('[', "{[}") -- to avoid interpretation as + , (']', "{]}") -- optional arguments , ('\160', "~") ] |