aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lentczner <markl@glyphic.com>2010-04-25 06:26:10 +0000
committerMark Lentczner <markl@glyphic.com>2010-04-25 06:26:10 +0000
commit5b7629a9e44276a0dca8e872b549c235c1101c3e (patch)
tree8c0f303aa8a40f8b990ea84026cb13848d3fb0c8
parenta70355a145e182bd1963ab707472dffb75f663bb (diff)
fixed javascript quoting/escpaing issue
-rw-r--r--src/Haddock/Backends/Xhtml.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Haddock/Backends/Xhtml.hs b/src/Haddock/Backends/Xhtml.hs
index 01b4c861..6e6decf7 100644
--- a/src/Haddock/Backends/Xhtml.hs
+++ b/src/Haddock/Backends/Xhtml.hs
@@ -566,9 +566,13 @@ ppHtmlModule odir doctitle
styleSheet +++
(script ! [src jsFile, thetype "text/javascript"] $ noHtml) +++
(script ! [thetype "text/javascript"]
- -- XXX: quoting errors possible?
- << ("window.onload = function () {setSynopsis(\"mini_"
- ++ moduleHtmlFile mdl ++ "\")};"))
+ -- NB: Within XHTML, the content of script tags needs to be
+ -- a CDATA section. Will break if the generated name could
+ -- have "]]>" in it!
+ << primHtml (
+ "//<![CDATA[\nwindow.onload = function () {setSynopsis(\"mini_"
+ ++ moduleHtmlFile mdl ++ "\")};\n//]]>\n")
+ )
) +++
body << (
pageHeader mdl_str iface doctitle