[kupu-dev] Avoid filtering of HTML-comments

sean.upton at uniontrib.com sean.upton at uniontrib.com
Thu Nov 8 20:16:47 CET 2007


Duncan Booth said:
> 
> > You can disable *all* filtering, but is there a way to just disable 
> > the html-comment filtering?
> > 
> Only by editing the filtering code. See 
> kupucontentfilters.js, right at the bottom where there is 
> code for copying nodeTypes 1, 3, and 4. Comments are nodeType 
> 8, so you could try adding something to copy those nodes. 
> Untested code, insert:
> 
> else if (kid.nodeType == 8) {
>   parentnode.appendChild(ownerdoc.createComment(kid.nodeValue));
> }
> 
> Be aware that recent versions of kupu in Plone will refuse to 
> edit any field which starts with an HTML comment: this allows 
> you to suppress kupu permanently for individual field instances.

Having both behaviors regarding HTML comments be configurable within the
Plone Kupu setup seems like it would be a good idea.  

Problem this has caused for media publishing applications I have
supported: authors comment out a piece of content with the intent of
possibly re-enabling it, and are surprised (to put it mildly) that it
vanishes.   Also, content imported from external systems generating HTML
often have HTML comments at the start of content.  

These behaviors violate principle of least-surprise for many users;
configurability in a control panel for Plone integrators (along with
associated documentation/warning, GS extension profile example) would be
an ideal (I might be able to contribute time to coding this).

Thoughts?

Sean


More information about the kupu-dev mailing list