git.iko.soy/typeable/pandoc
on master help sign in
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.

commitd79242796b5bfa24788d30b239de3b15c0ed326c authorJohn MacFarlane <jgm@berkeley.edu> dateMon 2 Sep 2019, 20:36 (7 years ago) parent5e708eb
2 files changed+3−7
src/Text/Pandoc/Writers/HTML.hs+2−6 test/command/ascii.md+1−1
src/Text/Pandoc/Writers/HTML.hs+2−6
@@ -59,8 +59,7 @@ import Text.DocTemplates (Context(..))
5959import Text.Pandoc.Walk
6060import Text.Pandoc.Writers.Math
6161import Text.Pandoc.Writers.Shared
62−import Text.Pandoc.XML (escapeStringForXML, fromEntities,
63− toEntities, toHtml5Entities)
62+import Text.Pandoc.XML (escapeStringForXML, fromEntities, toEntities)
6463#if MIN_VERSION_blaze_markup(0,6,3)
6564#else
6665import Text.Blaze.Internal (preEscapedString, preEscapedText)
@@ -207,10 +206,7 @@ writeHtmlString' :: PandocMonad m
207206writeHtmlString' st opts d = do
208207 (body, context) <- evalStateT (pandocToHtml opts d) st
209208 (if writerPreferAscii opts
210− then
211− if stHtml5 st
212− then toHtml5Entities
213− else toEntities
209+ then toEntities
214210 else id) <$>
215211 case writerTemplate opts of
216212 Nothing -> return $ renderHtml' body
test/command/ascii.md+1−1
@@ -2,7 +2,7 @@
22pandoc -t html --ascii
33äéıå
44^D
5−<p>&auml;&eacute;&imath;&aring;</p>
5+<p>&#228;&#233;&#305;&#229;</p>
66```
77
88```