Wiki links with spaces don't work

panuv - March 23, 2009 - 10:54
Project:TWikifilter
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:mradcliffe
Status:patch (to be ported)
Description

Hi,

The wiki links with spaces ([[http://url/][link text with spaces]]) don't seem to translate correctly (didn't translate at all, actually). I hunted it down to this line in twikifilter.module:
$mod = preg_replace("/\[\[$commonurls\]\[(\S+)\]\]/","<a href=\"$1\" title=\"$2\">$2</a>",$mod);
By modifying it to this made it work:
$mod = preg_replace("/\[\[$commonurls\]\[([\S ]+?)\]\]/","<a href=\"$1\" title=\"$2\">$2</a>",$mod);

Important to have the lazy plus [\S ]+? in there, otherwise it won't work if there are subsequent links. Probably should change all the other regex's handling the [[][]] -links too.

Note: I didn't check any of the TWiki documentation or code for this.

#1

mradcliffe - March 30, 2009 - 20:03
Assigned to:Anonymous» mradcliffe
Status:active» patch (to be ported)

Thanks, I'm going to test a few things.

 
 

Drupal is a registered trademark of Dries Buytaert.