git.iko.soy/typeable/pandoc
on master help sign in
Markdown writer: move asciify out of escapeString.
1fdf061John MacFarlane
src/Text/Pandoc/Writers/Markdown.hs+9−9
@@ -290,10 +290,7 @@ noteToMarkdown opts num blocks = do
290
290
291-- | Escape special characters for Markdown.
291-- | Escape special characters for Markdown.
292escapeText :: WriterOptions -> Text -> Text
292escapeText :: WriterOptions -> Text -> Text
293−escapeText opts =
293+escapeText opts = T.pack . go . T.unpack
294− (if writerPreferAscii opts
295− then toHtml5Entities
296− else id) . T.pack . go . T.unpack
297 where
294 where
298 go [] = []
295 go [] = []
299 go (c:cs) =
296 go (c:cs) =
@@ -1171,12 +1168,15 @@ inlineToMarkdown opts (Code attr str) = do
1171 (marker <> spacer <> str <> spacer <> marker) <> attrs
1168 (marker <> spacer <> str <> spacer <> marker) <> attrs
1172inlineToMarkdown opts (Str str) = do
1169inlineToMarkdown opts (Str str) = do
1173 variant <- asks envVariant
1170 variant <- asks envVariant
1171+ let str' = (if writerPreferAscii opts
1172+ then toHtml5Entities
1173+ else id) .
1174− let str' = (if isEnabled Ext_smart opts
1174+ (if isEnabled Ext_smart opts
1175 then unsmartify opts
1175 then unsmartify opts
1176− else id) $
1176+ else id) .
1177− if variant == PlainText
1177+ (if variant == PlainText
1178− then str
1178+ then id
1179− else escapeText opts str
1179+ else escapeText opts) $ str
1180 return $ literal str'
1180 return $ literal str'
1181inlineToMarkdown opts (Math InlineMath str) =
1181inlineToMarkdown opts (Math InlineMath str) =
1182 case writerHTMLMathMethod opts of
1182 case writerHTMLMathMethod opts of