aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2011-01-19 11:53:00 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2011-01-19 11:53:00 -0800
commitadaae082fc27e1d7897edfbb32412b25456e3c05 (patch)
treeb7141b2c19d1f9393a6f8cb2a1ba29447d84c864 /src/Text/Pandoc/Writers
parent9a739e30bfb979bf94084ada114ca80a0f793b6c (diff)
downloadpandoc-adaae082fc27e1d7897edfbb32412b25456e3c05.tar.gz
Fixed problem with inline code in ConTeXt writer.
Previously `}` would be rendered '\type{}}'. Now we check the string for '}' and '{'. If it contains neither, use \type{}; otherwise use \mono{} with an escaped version of the string. Note: There are some issues using the \type!str! form, including differences btw mkii and mkiv. For now this is a conservative fix. Perhaps in the future we can use \type!str!. See the discussion on pandoc-discuss s.v. "Bug in context writer".
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/ConTeXt.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
index b693bf7fa..da8668e1e 100644
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -244,8 +244,10 @@ inlineToConTeXt (Subscript lst) = do
inlineToConTeXt (SmallCaps lst) = do
contents <- inlineListToConTeXt lst
return $ braces $ "\\sc " <> contents
-inlineToConTeXt (Code str) =
+inlineToConTeXt (Code str) | not ('{' `elem` str || '}' `elem` str) =
return $ "\\type" <> braces (text str)
+inlineToConTeXt (Code str) =
+ return $ "\\mono" <> braces (text $ stringToConTeXt str)
inlineToConTeXt (Quoted SingleQuote lst) = do
contents <- inlineListToConTeXt lst
return $ "\\quote" <> braces contents