Page 1 of 1
No Textile links in comments?
Posted: Thu Jul 05, 2007 12:43 am
by Bman
Hi, I'm using the Textile plugin for posts and comments on my blog, and while I have no problems with posts, I don't ever get any Textile links in comments people post, as seen in some of the comments
here.
I am certain Textile
is being applied to the comments, since all the rest of the markup (bold, italic, etc) works fine. But not links for whatever reason.
I've made sure "Make external links clickable?" is set to
yes, I've tried changing the order of the spam filter plugin and the textile plugin, gone through all the spam filter settings, and even just deactivated the spam filter plugin entirely to see if it was responsible, and still no luck.
Is there something else I need to do in order to get the links working? Did I miss something completely obvious?
I'd really appreciate any help you can provide.
Re: No Textile links in comments?
Posted: Thu Jul 05, 2007 12:39 pm
by garvinhicking
Hi!
Phew. Sadly I have no experience with Textile as such. But if you enter the same markup for a link that you entered for a comment into an article, it gets properly formatted there?
Which other markup plugins are you using? Maybe another one interfers on comments with Textile...?
Regards,
Garvin
Posted: Thu Jul 05, 2007 8:30 pm
by Bman
Hi Garvin,
That's right, the format for links in textile is:
It gets converted to links as expected when I create blog posts, but not in comments. (You can see this happening on comment #5 in the link I posted.)
Textile is the only markup plugin I have installed. The other plugins installed are:
Event:
Spartacus
Spam Protector
Link List
Browser Compatibility
Just tried disabling all of those and it didn't make any difference.
Sidebar:
HTML nugget (x5)
Quicksearch
Link list
Remote RSS
Posted: Fri Jul 06, 2007 11:03 am
by garvinhicking
Hi!
Ah, it MIGHT be because s9y uses htmlspecialchars() on a comment which translates " to the quot;-Entity. Mabe this disturbs things.
So the textile plugin would need to be patched to also use quot; as a delimiter. Does the textile plugin maybe also accept the single quote ' within texts? Then you could try if that works?
For security means, s9y always escapes all comment input to prevent any XSS abuse, so sadly we can't prevent the use of it.... :-/
Regards,
Garvin
Posted: Sat Jul 07, 2007 6:40 am
by Bman
Ahh, I'll bet that's exactly what's going on. The textile plugin for s9y definitely doesn't accept single-quote for links, and it doesn't look like
the "official" converter does either. Go to that link and try:
Code: Select all
'this is a link':http://www.link.com/
"this is a link":http://www.link.com/
And you'll see that only the second one gets converted to an HTML link. I'm guessing the fix would be to update the regex in the Textile plugin so that it'll recognize " in addition to ".
So this
should fix it:
This is the original links handler, from textile.php:
Code: Select all
function textile_links($text)
{
global $textile_c;
return preg_replace_callback('/
([\s[{(]|[[:punct:]])? # $pre
" # start
('.$textile_c.') # $textile_atts
([^"]+) # $text
\s?
(?:\(([^)]+)\)(?="))? # $title
":
(\S+\b) # $url
(\/)? # $textile_slash
([^\w\/;]*) # $post
(?=\s|$)
/Ux',"textile_fLink",$text);
}
It would need to be changed to:
Code: Select all
function textile_links($text)
{
global $textile_c;
return preg_replace_callback('/
([\s[{(]|[[:punct:]])? # $pre
(?:"|") # start <<CHANGED
('.$textile_c.') # $textile_atts
([^"]+) # $text
\s?
(?:\(([^)]+)\)(?="))? # $title
(?:"|"): <<CHANGED
(\S+\b) # $url
(\/)? # $textile_slash
([^\w\/;]*) # $post
(?=\s|$)
/Ux',"textile_fLink",$text);
}
That
seems to have fixed it on my blog without causing anything to break. (You can see that comments now have the correct links in
the thread I linked before.) I leave the determination of how you'd like to integrate the fix into s9y itself in your capable hands.
Thanks for the help!
Posted: Sun Jul 08, 2007 8:46 pm
by garvinhicking
Hi!
Hey, cool, seems I guessed the right way.
Your patch is exactly what I would have done as well. Sorry for not providing this earlier on, I was a bit in a hurry. I committed that patch for the serendipity 1.3 version tree. I didn't date to put it into the 1.2 RCs because of possible b0rkage (even though I expected none).
Many thanks,
Garvin
Posted: Fri Oct 10, 2008 8:40 pm
by Bodehase
Is this fixed in the textile-Plugin-Version 1.6?
It seems to me, that it is still not working...
Posted: Mon Oct 13, 2008 6:04 pm
by judebert
Yes, it's fixed in 1.6, which comes with the latest versions.
The textile formatting will not be replaced if it's in a <php>, <output>, or <name> block. It might not be replaced if the "unescape" option isn't true. And of course, only double-quotes are allowed.
Check your HTML and configuration to make sure the tag is eligible for replacement.