Board index Bugs serendipity_event_s9ymarkup adds </u> to URLs breaking

Found a bug? Tell us!!
DLange
Regular
 
Posts: 9
Joined: Fri Apr 11, 2008 1:16 am

Postby DLange » Fri Apr 11, 2008 1:33 am

plugins/serendipity_event_s9ymarkup/serendipity_event_s9ymarkup.php:
Code: Select all
$text = preg_replace('/\b_([\S ]+?)_\b/','<u>\1</u>',$text);

does not honor URLs that may not be <u>'ified as
the URL
http://en.wikipedia.org/wiki/Statler_%26_Waldorf

that will end up
http://en.wikipedia.org/wiki/Statler</u>%26_Waldorf

as to be seen in
http://daniel-lange.com/archives/9-Wiki ... tions.html
(check the Statler and Waldorf link)

User avatar
garvinhicking
Core Developer
 
Posts: 29966
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Fri Apr 11, 2008 10:31 am

Hi!

Yes, the s9ymarkup plugin is pretty basic, it can easily screwp up text like this. In those cases you will need to disable s9ymarkup for entries which contain such text. Fixing this would hugely increase the complexity of this small plugin and defeat it's purpose for quick+simple markup.

Yeah, I also don't like what I write about this ;)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

DLange
Regular
 
Posts: 9
Joined: Fri Apr 11, 2008 1:16 am

Postby DLange » Fri Apr 11, 2008 10:43 am

Hi Garvin,

how about making the regex require (whitespace followed by understore) for <u> and (underscore followed by whitespace) for </u>? There are no whitespaces in URLs and this will not add any complexity.

All the best,
Daniel

(missing blank added in edit)

User avatar
garvinhicking
Core Developer
 
Posts: 29966
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Fri Apr 11, 2008 11:48 am

Hi!

But that would break formatting like:

Code: Select all
I really want _this_!


or

Code: Select all
_NO_body should ever change that.


Currently the regexp cannot differentiate between a URL and usual plaintext; and it would be pretty hard to detect what's a URL and what not without recursive/implicit regular expressions with backreferences...

:-/

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

DLange
Regular
 
Posts: 9
Joined: Fri Apr 11, 2008 1:16 am

Postby DLange » Fri Apr 11, 2008 12:06 pm

That's about priorities. I always prefer not breaking stuff over functionality, but it's obviously your choice to make. I can always patch my local copy (which I'll do, as it breaks my article).

DLange
Regular
 
Posts: 9
Joined: Fri Apr 11, 2008 1:16 am

Postby DLange » Fri Apr 11, 2008 12:14 pm

Hi @All,

my local version is fixed, thus the link mentioned in post #1 will not show the example in live action anymore.
But you can try the effect of serendipity_event_s9ymarkup breaking URLs with underscores in them out with your local serendipity blog.

Take care,
Daniel



Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron