Page 1 of 1

serendipity_event_s9ymarkup adds </u> to URLs breaking

Posted: Fri Apr 11, 2008 1:33 am
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)

Re: serendipity_event_s9ymarkup adds </u> to URLs brea

Posted: Fri Apr 11, 2008 10:31 am
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

Posted: Fri Apr 11, 2008 10:43 am
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)

Posted: Fri Apr 11, 2008 11:48 am
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

Posted: Fri Apr 11, 2008 12:06 pm
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).

Posted: Fri Apr 11, 2008 12:14 pm
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