[kupu-dev] nbsp tags disappear, breakin' paragraphs

bernhard g.bernhard at akbild.ac.at
Fri Feb 9 12:09:42 CET 2007


On 09.02.2007, at 11:31, Duncan Booth wrote:

> bernhard <g.bernhard at akbild.ac.at> wrote:
>
>> hello again, kupu list!
>>
>> i have another problem with kupu - i have made a button that inserts
>> an image into the dom tree usinng javascript. the html code that i
>> insert contains [&nbsp], because otherwise some elements of the code
>> are not selectable on clicks. when i click 'HTML' or save all the
>> [&nbsp] tags are being removed.
>
> Interesting. It seems that non-breaking spaces are being lost when  
> you use
> the HTML source view. If you enter &nbsp; in source view, go back  
> to the
> wysiwyg view, and save the document then you still have a non-breaking
> space (although it is no longer stored as an entity escape so you  
> have to
> examine a character dump to verify that this is the case).

Entering &nbsp; in html view and switching back to 'normal' kupu view  
i found no &nbsp; any more; I looked into the dom using Firebug - no  
&nbsp;
The only suspicious line i found in kupu code is:
kupuploneeditor.js #103
'''
     if (/^<body[^>]*>(<\/?(p|br)[^>]*>|\&nbsp;)*<\/body>$/.test 
(contents)) {
         contents = ''; /* Ignore nearly empty contents */
     }
'''

> I guess there's a bug somewhere. Probably I need to entity escape the
> source view which is a pity as I can't entity escape the text that  
> Kupu
> saves because Plone has (or had? I haven't checked recently) buggy  
> full-
> text indexing which didn't understand html entities.

If you want to have a serious i18n aware catalog you will have to use  
TextIndexNG - and TextIndexNG knows how to deal with html entities  
(hopefully); I would like to know if it is hard to locate the code  
where the entities are dropped - is it zope, plone or kupu? As long  
as it is not Python we definitively can handle :-P  People are unable  
to edit the image modules i put in otherwise.

>> another issue is that kupu seems to insert [p][br /][/p] sometimes
>> when return is pressed; can i prevent this, too?
>
> Firefox? If you figure out a way to prevent Firefox inserting strange
> things when you hit return then I'll buy you several beers.

If you can make &nbsp; persistent I owe YOU one ;-)

Let's find that.
Gogo.





More information about the kupu-dev mailing list