Interwiki regexp bug

timj - October 8, 2007 - 19:01
Project:PEAR Wiki Filter
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

given an interwiki mapping configuration such as
"Local drupal path | local | /%s"
a wiki link such as:
* [[local:rapicorn/rdocu-rapicorn/index.html| API Reference]]
gets mis-parsed and yields:

  • API Reference
  • note the "local%3A", respectively "local:" in the href.

    this is due to a misplaced '-' in the interwiki regexp character
    set. to include '-' in []-braketed regexp character sets, the
    hyphen must be noted at either end of the character set:
    --- ./pear_override/parse_mediawiki/Interwiki.php.orig 2007-10-08 20:36:55.000000000 +0200
    +++ ./pear_override/parse_mediawiki/Interwiki.php 2007-10-08 20:41:39.000000000 +0200
    @@ -3,7 +3,7 @@
    class Text_Wiki_Parse_Interwiki extends Text_Wiki_Parse {

    // double-colons wont trip up now
    - var $regex = '([A-Za-z0-9_]+):((?!:)[A-Za-z0-9_\/=&~#.:;-<> ]+)';
    + var $regex = '([A-Za-z0-9_]+):((?!:)[A-Za-z0-9_\/=&~#.:;<> -]+)';

    function parse()
    {
    (moved hyphen to closing braket)
    this patch applied, the URL is correctly transformed, according
    to the configuration:

  • API Reference
  •  
     

    Drupal is a registered trademark of Dries Buytaert.