aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-07-18 23:17:37 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-07-19 22:51:59 -0700
commit490f34dee5a1fc046d66ec1adf32f4c24c5f5e4f (patch)
tree2ae214d7e85ecfeed69f12d696044b9afdc3c44b /src/Text/Pandoc
parentd6b7b1dc772249e9a1b56bcdd4ae816cc54edb51 (diff)
downloadpandoc-490f34dee5a1fc046d66ec1adf32f4c24c5f5e4f.tar.gz
Markdown writer: move asciify out of escapeString.
Otherwise unsmartify doesn't catch quotes that have already been turned to entities.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 37cdca005..15807123e 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -290,10 +290,7 @@ noteToMarkdown opts num blocks = do
-- | Escape special characters for Markdown.
escapeText :: WriterOptions -> Text -> Text
-escapeText opts =
- (if writerPreferAscii opts
- then toHtml5Entities
- else id) . T.pack . go . T.unpack
+escapeText opts = T.pack . go . T.unpack
where
go [] = []
go (c:cs) =
@@ -1171,12 +1168,15 @@ inlineToMarkdown opts (Code attr str) = do
(marker <> spacer <> str <> spacer <> marker) <> attrs
inlineToMarkdown opts (Str str) = do
variant <- asks envVariant
- let str' = (if isEnabled Ext_smart opts
+ let str' = (if writerPreferAscii opts
+ then toHtml5Entities
+ else id) .
+ (if isEnabled Ext_smart opts
then unsmartify opts
- else id) $
- if variant == PlainText
- then str
- else escapeText opts str
+ else id) .
+ (if variant == PlainText
+ then id
+ else escapeText opts) $ str
return $ literal str'
inlineToMarkdown opts (Math InlineMath str) =
case writerHTMLMathMethod opts of