[pmwiki-users] Change default page name separator to "-", ie "Page-Name"

Ed W lists at wildgooses.com
Tue Mar 3 15:02:04 CST 2009


Patrick R. Michaud wrote:
> On Wed, Feb 25, 2009 at 06:16:05PM +0000, Ed W wrote:
>   
>> Given that I notice PmWiki moving away from CamelCase wiki words, it
>> seems like there should be little resistance to proposing a change in
>> the default URL naming convention also...
>>     
>
> I'm fully in favor of this, *if* we can find a way to make the
> change without breaking existing sites.  But in my experience 
> ranks up there with "convert PmWiki's default to utf8" in terms 
> of actual difficulty of achieving the result.
>   

OK, I changed this in local/config.php

$PageNameChars='-[:alnum:]';
$MakePageNamePatterns = array(
    "/'/" => '',                           # strip single-quotes
    "/[^$PageNameChars]+/" => ' ',         # convert everything else to 
space
    "/(^\\s+)|(\\s+\$)/" => '',            # trim whitespaces
    '/((^|[^-\\w])\\w)/e' => "strtoupper('$1')",
    '/\\s+/' => '-');

This does most of what people might expect.  Couple of issues remain:

- There are lots of hardcoded CamelCase variables still in the code, eg:

$RecentChangesFmt = array(
  '$SiteGroup.AllRecentChanges' =>
    '* [[{$Group}.{$Name}]]  . . . $CurrentTime $[by] $AuthorLink: 
[=$ChangeSummary=]',
  '$Group.RecentChanges' =>
    '* [[{$Group}/{$Name}]]  . . . $CurrentTime $[by] $AuthorLink: 
[=$ChangeSummary=]');

The functions using the variable above don't run the name through the 
function to make a page name either, so simply editing this array to 
have a spaced name doesn't collapse in the expected predefined way

Patrick - do you have a suggestion on how this could be addressed?


- All the existing pages in wikilib.d aren't found (wrong naming convention)

This could be fixed with a "backwards compatibility fixup" in either 
ReadPage or further downstream in the "read" function for the 
pagestore.  The idea would be to first search for the expected name, 
then generate what the old name would look like and search for that. Any 
comments on this?

Question on what happens if you save - I guess check for the old name 
existing and at that point rename the old page to the new format...?


Thanks for any thoughts

Ed W
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20090303/7539fb69/attachment.html 


More information about the pmwiki-users mailing list