[kupu-dev] why is kupu converting br to p ? FIX

Esko Virtanen esko.virtanen at sll.fi
Mon Feb 16 18:54:23 CET 2009


I looked at the code and found kupucontentfilters.js line 708

   this._cleanupBr = function(ownerdoc, root)

When there is no p tags around the whole page, this function replaces br 
tags with lines containing <p>&nbsp</p>. In some cases these lines are 
doubled: 

some content
<p>&nbsp;</p>
<p>&nbsp;</p>
more content
<p>&nbsp;</p>
<p>&nbsp;</p>
etc

The fix is to tell every web-manager to check that <p> tags exist in the 
beginning and end of the HTML before they exit HTML-mode in Kupu. This is 
not a good solution because most of the people do not understand html. 

Is it possible to fine-tune function cleanupBr to add missing p tags 
around the whole page instead of converting br tags everywhere? 


Example 1
=========

Paste following code to kupu in HTML-mode:
<a href=http://www.plone.org/>Plone</a><br />
<a href=http://www.zope.com/>Zope</a><br />

That becomes:
<a href="http://www.plone.org/">Plone</a>
<p>&nbsp;</p>
<a href="http://www.zope.com/">Zope</a>
<p>&nbsp;</p>

instead of 

<p>
<a href=http://www.plone.org/>Plone</a><br />
<a href=http://www.zope.com/>Zope</a><br />
</p>

or

<p><a href=http://www.plone.org/>Plone</a></p>
<p><a href=http://www.zope.com/>Zope</a></p>


Example 2
=========

Paste following code to kupu in HTML-mode:

<p>
<a href=http://www.plone.org/>Plone</a><br />
<a href=http://www.zope.com/>Zope</a><br />
</p>

That remains the same


Esko



More information about the kupu-dev mailing list