[pmwiki-users] automatic page titles (aless)

aless alessors at gmail.com
Sat Aug 2 02:33:45 CDT 2008


>>  [...] I found also the AlternateNamingScheme recipe in the Cookbook
>> (http://www.pmwiki.org/wiki/Cookbook/AlternateNamingScheme), and
>> following the instructions I came up with this array that should transform
>>
>> l'albero di natale => L_albero_di_natale:
>>
>> $MakePageNamePatterns = array(
>>      "/'/" => '',                           # strip single-quotes
>>      "/[^$PageNameChars]+/" => ' ',         # convert non-alnums to spaces
>>      "/(^\\w)/e" => "strtoupper('$1')",     # initial caps
>>
>>      "/\\s+/" => '_'                        # Convert spaces to
>> underscores
>> );
> 
> It should be possible to handle the apostrophe too. One option
> would be to use the ~ character in the pagename and url as a
> surrogate for the ' and then convert "~" to "'" on output, in much
> the same way as the above code converts '_' to ' '. This is done in
> the custom $AsSpacedFunction.

Hello John,

actually, page names with underscores instead of apostrophes are still 
quite readable, I wanted to try your solution too, but I really don't 
know where to start, could you give me some more hints? I tried to put 
this in my config.php, but it still converts single quotes to spaces and 
then to underscores:

$PageNameChars = '-~[:alnum:]';

$MakePageNamePatterns = array(
     "/'/" => '~',                           # strip single-quotes
     "/[^-[:alnum:]]+/" => ' ',         # convert non-alnums to spaces
     "/(^\\w)/e" => "strtoupper('$1')",     # initial caps
     "/\\s+/" => '_');                      # Convert spaces to underscores

I think I'm missing something, don't I?

By the way, as a side effect of having the new page naming scheme, the 
old links are obviously not recognized anymore, for example, most of the 
pages in the Documentation Index. Should I rename them manually or is 
there a quicker solution? A renaming script, maybe?

Thanks for your help.

Have a nice weekend,
  alessandro



More information about the pmwiki-users mailing list