Forum closed. New forum available at http://community.wymeditor.org/

[BUG] xhtml() throws super/subscripted "s" character out

Discuss features, code, contributions, ideas, suggestions, ...
For bugs, patches and feature requests, please post on the Trac:
http://trac.wymeditor.org/

[BUG] xhtml() throws super/subscripted "s" character out

Postby pl! on Fri May 16, 2008 8:40 am

Hi,

couldn't find a thread for this bug, so here's the description:

I insert "this is sparta" into the editor's textfield

I super- or subscript the "s" of "sparta"

What's supposed to be the output of wymEditor.xhtml(): "this is <sup>s</sup>parta".

What actually comes out is "this is parta". Seems like it's only the "s" as other characters get wrapped with <sup> or <sub> tags perfectly.

wymEditor version is 0.4, but this also occures on that 0.5 alpha from may 8th.

I hope someone can give me a workaround. I can't use wymEditor.html() as it causes other issues on our system.
pl!
 
Posts: 8
Joined: Thu Jan 31, 2008 2:37 pm

Re: [BUG] xhtml() throws super/subscripted "s" character out

Postby PACE on Sat May 17, 2008 5:52 am

Confirmed. In fact not only superscript is a trigger for this bug, any single "s" wrapped in tags is discarded along with the tags. The cause for this is in function WYMeditor.XhtmlSaxListener.prototype.removeEmptyTags, which consists of this line:
Code: Select all
return xhtml.replace(new RegExp('<('+this.block_tags.join("|")+')>(<br \/>|&#160;|&nbsp;|\s)*<\/\\1>' ,'g'),'');

There is a backslash missing before "\s", so it erroneously strips tags containing "s" instead of tags containing whitespaces :)
Just change this to
Code: Select all
return xhtml.replace(new RegExp('<('+this.block_tags.join("|")+')>(<br \/>|&#160;|&nbsp;|\\s)*<\/\\1>' ,'g'),'');


I have filed a bug report too (https://trac.wymeditor.org/trac/ticket/107)

br,
Ben
PACE
 
Posts: 15
Joined: Fri Oct 12, 2007 10:24 am
Location: Austria

Re: [BUG] xhtml() throws super/subscripted "s" character out

Postby pl! on Mon May 19, 2008 7:52 am

Thank you for your quick reply. Works perfectly now !
pl!
 
Posts: 8
Joined: Thu Jan 31, 2008 2:37 pm

Re: [BUG] xhtml() throws super/subscripted "s" character out

Postby jfh on Mon May 19, 2008 8:44 pm

Thanks for the feedback - patch applied (see r500).
User avatar
jfh
Site Admin
 
Posts: 370
Joined: Sat Sep 23, 2006 8:43 pm
Location: Belgium


Return to Developers

Who is online

Users browsing this forum: No registered users and 2 guests