serendipity_event_s9ymarkup adds </u> to URLs breaking

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

serendipity_event_s9ymarkup adds </u> to URLs breaking

Post by DLange »

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
that will end up
as to be seen in
http://daniel-lange.com/archives/9-Wiki ... tions.html
(check the Statler and Waldorf link)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: serendipity_event_s9ymarkup adds </u> to URLs brea

Post by garvinhicking »

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: 16
Joined: Fri Apr 11, 2008 1:16 am

Post by DLange »

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)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

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: 16
Joined: Fri Apr 11, 2008 1:16 am

Post by DLange »

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: 16
Joined: Fri Apr 11, 2008 1:16 am

Post by DLange »

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
Post Reply