git.iko.soy/typeable/pandoc
on master help sign in
Markdown writer: move asciify out of escapeString.

Otherwise unsmartify doesn't catch quotes that have already been turned to entities.

commit1fdf06121b2fb1bca7f333d63d2453d727f634e2 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 18 Jul 2020, 23:17 (6 years ago) parent54fe3f7
1 file changed+9−9
src/Text/Pandoc/Writers/Markdown.hs+9−9
src/Text/Pandoc/Writers/Markdown.hs+9−9
@@ -290,10 +290,7 @@ noteToMarkdown opts num blocks = do
290290
291291-- | Escape special characters for Markdown.
292292escapeText :: WriterOptions -> Text -> Text
293−escapeText opts =
294− (if writerPreferAscii opts
295− then toHtml5Entities
296− else id) . T.pack . go . T.unpack
293+escapeText opts = T.pack . go . T.unpack
297294 where
298295 go [] = []
299296 go (c:cs) =
@@ -1171,12 +1168,15 @@ inlineToMarkdown opts (Code attr str) = do
11711168 (marker <> spacer <> str <> spacer <> marker) <> attrs
11721169inlineToMarkdown opts (Str str) = do
11731170 variant <- asks envVariant
1174− let str' = (if isEnabled Ext_smart opts
1171+ let str' = (if writerPreferAscii opts
1172+ then toHtml5Entities
1173+ else id) .
1174+ (if isEnabled Ext_smart opts
11751175 then unsmartify opts
1176− else id) $
1177− if variant == PlainText
1178− then str
1179− else escapeText opts str
1176+ else id) .
1177+ (if variant == PlainText
1178+ then id
1179+ else escapeText opts) $ str
11801180 return $ literal str'
11811181inlineToMarkdown opts (Math InlineMath str) =
11821182 case writerHTMLMathMethod opts of