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.
This commit is contained in:
John MacFarlane 2019-09-02 20:36:57 -07:00
parent 5e708eb8ce
commit d79242796b
2 changed files with 3 additions and 7 deletions

View file

@ -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

View file

@ -2,7 +2,7 @@
pandoc -t html --ascii
äéıå
^D
<p>&auml;&eacute;&imath;&aring;</p>
<p>&#228;&#233;&#305;&#229;</p>
```
```