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) |
Jump to:
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
Thanks, I'm going to test a few things.