diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-09-02 20:36:57 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-09-02 20:36:57 -0700 |
commit | d79242796b5bfa24788d30b239de3b15c0ed326c (patch) | |
tree | 676099d7c5601b8e234f01e61ad3644da43bdf21 | |
parent | 5e708eb8ce4bb4325b009ac37a5986517d6b9290 (diff) | |
download | pandoc-d79242796b5bfa24788d30b239de3b15c0ed326c.tar.gz |
HTML writer: use numeric character references with `--ascii`.
Previously we used named character references with html5 output.
But these aren't valid XML, and we aim to produce html5 that is
also valid XHTML (polyglot markup). (This is also needed for
epub3.)
Closes #5718.
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 8 | ||||
-rw-r--r-- | test/command/ascii.md | 2 |
2 files changed, 3 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index af0780e99..38b0e1974 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -59,8 +59,7 @@ import Text.DocTemplates (Context(..)) import Text.Pandoc.Walk import Text.Pandoc.Writers.Math import Text.Pandoc.Writers.Shared -import Text.Pandoc.XML (escapeStringForXML, fromEntities, - toEntities, toHtml5Entities) +import Text.Pandoc.XML (escapeStringForXML, fromEntities, toEntities) #if MIN_VERSION_blaze_markup(0,6,3) #else import Text.Blaze.Internal (preEscapedString, preEscapedText) @@ -207,10 +206,7 @@ writeHtmlString' :: PandocMonad m writeHtmlString' st opts d = do (body, context) <- evalStateT (pandocToHtml opts d) st (if writerPreferAscii opts - then - if stHtml5 st - then toHtml5Entities - else toEntities + then toEntities else id) <$> case writerTemplate opts of Nothing -> return $ renderHtml' body diff --git a/test/command/ascii.md b/test/command/ascii.md index 492bf248f..214e10f13 100644 --- a/test/command/ascii.md +++ b/test/command/ascii.md @@ -2,7 +2,7 @@ pandoc -t html --ascii äéıå ^D -<p>äéıå</p> +<p>äéıå</p> ``` ``` |