[kupu-dev] kupu html-escapes the contents of the <script> and <noscript> tags
Duncan Booth
duncan.booth at suttoncourtenay.org.uk
Mon Mar 17 14:31:53 CET 2008
"Antoine Brenner" <pythonjob at gymglish.com> wrote:
> Thus two questions:
> 1) Is it correct that kupucontentfilters.js is to be modified ?
> if yes:
> 2) How should I modify kupucontentfilters.js so that the contents of the
><script> and <noscript> tags are left unchanged ?
Right now it's badly broken: every time you edit the noscript tag gets
another level of escaping. Unfortunately I don't think it is easy to fix.
Kupu works by building an XML document containing the filtered html and
then serialising it. In the original html the content of the <noscript> tag
is simply text, so it is copied into the XML DOM as text and serialised
acoordingly. What you would have to do (I think) is force your browser to
parse the HTML inside the noscript tag into a DOM and then get kupu to
serialise that into the XML DOM. Alternatively you might use a regex
replace to unescape the content of all noscript tags after serialising.
And of course when editing with kupu you'll see the content of the
<noscript> tags as raw HTML because that's what it is.
You can't edit <script> tags inside kupu anyway as they are invisible.
I'd suggest that if you really need <script> and <noscript> you simply turn
off kupu for those documents where you need them: suppress kupu manually
(add ?kupu.suppress=text to the url) and put an HTML comment at the start
of the content then kupu won't appear for that document.
More information about the kupu-dev
mailing list