summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-09-12 09:24:25 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-09-12 09:25:15 -0700
commitca6842349e23b3f60cb2665d1c20de9951bea268 (patch)
tree3e5368db87aabac769e984cf5ea008dc0764e23a
parent873a21170e1749366f0f6844c884ccf3a40e2c92 (diff)
HTML writer: Ensure proper escaping in header metadata.
-rw-r--r--changelog1
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs9
2 files changed, 6 insertions, 4 deletions
diff --git a/changelog b/changelog
index f2742664c..a892ab0ec 100644
--- a/changelog
+++ b/changelog
@@ -405,6 +405,7 @@
+ Fixed `--no-highlight` (Alexander Kondratskiy).
+ Don't convert to lowercase in email obfuscation (#839).
+ + Ensure proper escaping in `<title>` and `<meta>` fields.
* AsciiDoc writer:
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 78a3edce8..902c8bc53 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -39,7 +39,7 @@ import Text.Pandoc.Readers.TeXMath
import Text.Pandoc.Slides
import Text.Pandoc.Highlighting ( highlight, styleToCss,
formatHtmlInline, formatHtmlBlock )
-import Text.Pandoc.XML (fromEntities)
+import Text.Pandoc.XML (fromEntities, escapeStringForXML)
import Network.HTTP ( urlEncode )
import Numeric ( showHex )
import Data.Char ( ord, toLower )
@@ -115,8 +115,9 @@ pandocToHtml opts (Pandoc meta blocks) = do
(fmap renderHtml . blockListToHtml opts)
(fmap renderHtml . inlineListToHtml opts)
meta
- let authsMeta = map stringify $ docAuthors meta
- let dateMeta = stringify $ docDate meta
+ let stringifyHTML = escapeStringForXML . stringify
+ let authsMeta = map stringifyHTML $ docAuthors meta
+ let dateMeta = stringifyHTML $ docDate meta
let slideLevel = maybe (getSlideLevel blocks) id $ writerSlideLevel opts
let sects = hierarchicalize $
if writerSlideVariant opts == NoSlides
@@ -168,7 +169,7 @@ pandocToHtml opts (Pandoc meta blocks) = do
maybe id (defField "toc" . renderHtml) toc $
defField "author-meta" authsMeta $
maybe id (defField "date-meta") (normalizeDate dateMeta) $
- defField "pagetitle" (stringify $ docTitle meta) $
+ defField "pagetitle" (stringifyHTML $ docTitle meta) $
defField "idprefix" (writerIdentifierPrefix opts) $
-- these should maybe be set in pandoc.hs
defField "slidy-url"