From adaae082fc27e1d7897edfbb32412b25456e3c05 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 19 Jan 2011 11:53:00 -0800 Subject: 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". --- src/Text/Pandoc/Writers/ConTeXt.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc/Writers') 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 -- cgit v1.2.3