Andrei Stebakov
2008-02-27 17:12:06 UTC
When we generate the JavaScript <script> with cl-who we need to put the
empty string at the end of the command to have the closing </script> tag
like so:
(with-html-output-to-string (*standard-output* nil :prologue nil :indent
nil)
(:html
(:head (:title "Temporary page")
(:script :language "JavaScript" :src "/test/scripts.js"
:type "text/javascript" ""))))
It will generate:
<html><head><title>Temporary page</title><script language='JavaScript'
src='/test/scripts.js' type='text/javascript'></script></head></html>
Now if we parse the html with html-parse:parse-html command and convert it
back to the string with tree-to-string (here is the
thread<http://common-lisp.net/pipermail/cl-who-devel/2007-November/000109.html>about
this command) we'll get the broken <script> tag without the closing
</script>
It's because html-parse:parse-html will produce
((:HTML
(:HEAD (:TITLE "Temporary page")
((:SCRIPT :LANGUAGE "JavaScript" :SRC "/test/scripts.js" :TYPE
"text/javascript")))))
Note, that there is no "" at the end of (:script) anymore.
My question is where this problem should be fixed at html-parse:parse-html
level so that parse-html would insert the "" when it finds the <script> tag,
or there is a clean way to do it in cl-who?
empty string at the end of the command to have the closing </script> tag
like so:
(with-html-output-to-string (*standard-output* nil :prologue nil :indent
nil)
(:html
(:head (:title "Temporary page")
(:script :language "JavaScript" :src "/test/scripts.js"
:type "text/javascript" ""))))
It will generate:
<html><head><title>Temporary page</title><script language='JavaScript'
src='/test/scripts.js' type='text/javascript'></script></head></html>
Now if we parse the html with html-parse:parse-html command and convert it
back to the string with tree-to-string (here is the
thread<http://common-lisp.net/pipermail/cl-who-devel/2007-November/000109.html>about
this command) we'll get the broken <script> tag without the closing
</script>
It's because html-parse:parse-html will produce
((:HTML
(:HEAD (:TITLE "Temporary page")
((:SCRIPT :LANGUAGE "JavaScript" :SRC "/test/scripts.js" :TYPE
"text/javascript")))))
Note, that there is no "" at the end of (:script) anymore.
My question is where this problem should be fixed at html-parse:parse-html
level so that parse-html would insert the "" when it finds the <script> tag,
or there is a clean way to do it in cl-who?