[kupu-dev] Avoid filtering of HTML-comments

Duncan Booth duncan.booth at suttoncourtenay.org.uk
Thu Nov 8 15:52:14 CET 2007


Wouter Vanden Hove <wouter at netcentric.be> wrote:

> Hi,
> 
> I fail to find meaningful pointers on how to disable the filtering of
> html-comments in kupu.  I'm migrating legacy content that contains many
> meaningful text in html-comments that should be preserved.
> 
> 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.



More information about the kupu-dev mailing list