Markdown writer: move asciify out of escapeString.
Otherwise unsmartify doesn't catch quotes that have already been turned to entities.
This commit is contained in:
parent
d6b7b1dc77
commit
490f34dee5
1 changed files with 9 additions and 9 deletions
|
@ -290,10 +290,7 @@ noteToMarkdown opts num blocks = do
|
||||||
|
|
||||||
-- | Escape special characters for Markdown.
|
-- | Escape special characters for Markdown.
|
||||||
escapeText :: WriterOptions -> Text -> Text
|
escapeText :: WriterOptions -> Text -> Text
|
||||||
escapeText opts =
|
escapeText opts = T.pack . go . T.unpack
|
||||||
(if writerPreferAscii opts
|
|
||||||
then toHtml5Entities
|
|
||||||
else id) . T.pack . go . T.unpack
|
|
||||||
where
|
where
|
||||||
go [] = []
|
go [] = []
|
||||||
go (c:cs) =
|
go (c:cs) =
|
||||||
|
@ -1171,12 +1168,15 @@ inlineToMarkdown opts (Code attr str) = do
|
||||||
(marker <> spacer <> str <> spacer <> marker) <> attrs
|
(marker <> spacer <> str <> spacer <> marker) <> attrs
|
||||||
inlineToMarkdown opts (Str str) = do
|
inlineToMarkdown opts (Str str) = do
|
||||||
variant <- asks envVariant
|
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
|
then unsmartify opts
|
||||||
else id) $
|
else id) .
|
||||||
if variant == PlainText
|
(if variant == PlainText
|
||||||
then str
|
then id
|
||||||
else escapeText opts str
|
else escapeText opts) $ str
|
||||||
return $ literal str'
|
return $ literal str'
|
||||||
inlineToMarkdown opts (Math InlineMath str) =
|
inlineToMarkdown opts (Math InlineMath str) =
|
||||||
case writerHTMLMathMethod opts of
|
case writerHTMLMathMethod opts of
|
||||||
|
|
Loading…
Add table
Reference in a new issue