[pmwiki-users] wiki trail navigation

John Rankin john.rankin at affinity.co.nz
Mon May 19 20:37:14 CDT 2014


On 20/05/14 4:31 AM, Petko Yotov wrote:
> John Rankin writes:
>
>>
>> We have a link on a trail page that reads:
>>
>> * [[1960: to Rob on his 46th birthday]]
>>
>> The pagename resolves to 1960ToRobOnHis46thBirthday, but the colon 
>> after 1960 causes the page to be omitted from the trail. ReadTrail in 
>> trails.php matches [^|:]*? in the link name, so skips the entry.
>
> Correct. Colons are not allowed in page names, and it assumes that 
> this is not a link to a page in the trail, for example an InterMap link.
>
>> To get around this, we have written:
>>
>> * [[1960 to Rob on his 46th birthday |1960: to Rob on his 46th 
>> birthday]]
>>
>> Is there a simpler way?
>
>  * [[1960 to Rob on his 46th birthday|+]]
Right, because we also need to add a title to that page to insert the 
colon. Thanks!
>
>
>> Also, $Titlespaced resolves to "1960 To Rob On His46th Birthday". I 
>> wonder whether AsSpaced might look for and space (lower)(\d+lower). 
>> Or would this be undesirable?
>
> If it is desirable to change the default "spacing" way, PmWiki can use 
> a different function to space the page names:
>
>  $AsSpacedFunction = "MyOwnAsSpaced"; # use MyOwnAsSpaced() to space 
> names
I did it this way. However, it would be nice if one could set a match / 
replace array pair in local/config.php, which PmWiki then applies. In 
this example:

$LocalAsSpacedRules = array('/([[:lower:]])(\d+[[:lower:]])/' => '$1 $2');

My code sets $PmAsSpacedFunction = $AsSpacedFunction then MyOwnAsSpaced 
function calls $PmAsSpacedFunction first, before applying the extra 
rule. However, if the site uses utf-8, $PmAsSpacedFunction needs to be 
set *after* loading xlpage-utf-8, which redefines $AsSpacedFunction.
>
> Or, simply set the page title in a (:title ...:) directive instead.
 From a user perspective, it looks like a spacing error, so I think it's 
better to fix in software.

Thanks.
JR

-- 
John Rankin




More information about the pmwiki-users mailing list