[pmwiki-users] automatic page titles (aless)

John Rankin john.rankin at affinity.co.nz
Sat Aug 2 18:18:51 CDT 2008


>From: aless <alessors at gmail.com>
>Subject: Re: [pmwiki-users] automatic page titles (aless)
>I tried to adapt the third solution of the recipe Alternate Naming 
>Scheme (http://www.pmwiki.org/wiki/Cookbook/AlternateNamingScheme) to 
>get apostrophes in page titles as John suggested:
>
>' => ~ for page names and URLS
>
>~ => ' for page display
>
>But every time I try to create a page that contains an
>apostrophe I get:
>
>PmWiki can't process your request
>
>?invalid page name
>
>Any idea?

Yes, I think you also need to redefine $NamePattern, which doesn't
know a ~ is a valid page name character.

Try adding

$NamePattern = '[[:upper:]\\d][\\w]*(?:[-~]\\w+)*';

to local/config.php -- the problem is that \\w includes _ but not ~.
>
>Here's the modified code:
>
>
>[...]

>$AsSpacedFunction = 'AsSpacedUnderlines';
>function AsSpacedUnderlines($text) {
>if ( $text=='_' ) {
>return strtr($text,'_',' ');
>}
>
>if ( $text=='~' ) {
>return strtr($text,'~',''');   # ~ => ' single quote need to be escaped?
>}

I think you can just write:

return str_replace(array('_','~'), array(' ','&rsquo;'), $text);

(we may as well turn the ~ into a curly quote character!
>
>}


JR
-- 
John Rankin
Affinity Limited
T 64 4 495 3737
F 64 4 473 7991
021 RANKIN
john.rankin at affinity.co.nz
www.affinity.co.nz





More information about the pmwiki-users mailing list