correct handling of style & script blocks

pull/2/head
Matthew Butterick 10 years ago
parent 4de4c28261
commit 0f880e6931

@ -196,4 +196,4 @@
(list '(root (div "foo") "hello" "world" (div "foo") (em "goodnight" "moon" (div "foo"))) '((meta "foo" "bar") (meta "foo2" "bar2") (meta "foo3" "bar3"))))
(check-equal? (xexpr->html '(root (script "3 > 2") "Why is 3 > 2?"))
"<root><script><![CDATA[3 > 2]]></script>Why is 3 &gt; 2?</root>"))
"<root><script>3 > 2</script>Why is 3 &gt; 2?</root>"))

@ -240,7 +240,7 @@
(Xexpr -> Xexpr)
(cond
[(cdata? x) x]
[(string? x) (cdata #f #f (format "<![CDATA[~a]]>" x))]
[(string? x) (cdata #f #f x)] ; don't use "![CDATA[...]]" wrapper in HTML, it's not consistent with the spec
[else x]))
(xexpr->string (let: loop : Xexpr ([x : Xexpr x])
(cond

Loading…
Cancel
Save