[pmwiki-users] \\L LinkPattern Replace in Markup Rules

Sebastian Siedentopf schlaefer at macnews.de
Wed Oct 19 09:17:37 CDT 2005


Am 19.10.2005 um 14:43 schrieb Patrick R. Michaud:

> On Wed, Oct 19, 2005 at 10:03:08AM +0200, Sebastian Siedentopf wrote:
>
>>> However, I suspect the problem has nothing to do with $LinkPatterns
>>> or the \L, as these are used only for *external* links.  WikiWord
>>> and other page links are handled by other markup rules that don't
>>> make use of \L.
>>>
>>
>> If I use:
>>     A simple test link: http://google.de
>>
>> I end up with all words as links:
>>    A? simple? test? link:? http://google.de?
>>
>> If I change:
>>     ## bare urllinks
>>     Markup('urllink','>[[',"/\\b(?>(\\L))...
>>
>> to:
>>     ## bare urllinks
>>     Markup('urllink','>[[',"/\\b(?>(html))...
>>
>> I end up with:
>>     A simple test link: http://google.de?
>>
>> Where http://google.de always points to the wiki page google/de.
>> Something is wonky with the overall link handling here.
>>
>
> Is anything modifying the $LinkPattern array?  You would get
> this result if there's a "null" entry in the $LinkPattern
> array somehow.
>
> Pm
>

Yes, $LinkPattern is empty when BuildMarkupRules() is called. I  
manually have to (re)build the $LinkPattern in the xajax handler:

foreach((array)$InterMapFiles as $f) {
   if (@!($mapfd=fopen($f,"r"))) continue;
   while ($mapline=fgets($mapfd,1024)) {
     if (preg_match('/^\\s*(#|$)/',$mapline)) continue;
     list($imap,$url) = preg_split('/\\s+/',$mapline);
     if (strpos($url,'$1')===false) $url.='$1';
     $LinkFunctions["$imap:"] = 'LinkIMap';
     $IMap["$imap:"] = FmtPageName($url, $pagename);
   }
}
SDV($LinkPattern, implode('|',array_keys($LinkFunctions)));

I'm not a php guru, so I'm not shure, but I think it has something to  
do with the scope of variables and includes when using xajax.

Sebastian





More information about the pmwiki-users mailing list