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

Eemeli Aro eemeli at gmail.com
Wed Feb 25 13:49:42 CST 2009


2009/2/25 Ed W <lists at wildgooses.com>:
> 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...

All you need to change is the mapping between URLs and internal file
names to achieve this. For this particular mapping, the following
ought to be enough:

$PageNameChars = '[:alnum:]';
$MakePageNamePatterns, array(
  "/'/" => '',
  "/[^$PageNameChars]+/" => ' ',
  '/((^|[^\\w])\\w)/e' => "strtoupper('$1')",
  '/ /' => '');
$EnablePathInfo = 1; # makes the following a little simpler
$FmtPV['$PageUrl'] = 'PUE("$ScriptUrl/".strtolower(
  preg_replace( "#(?<=[^/])[:upper:]#", "-$0", "$group/$name")))';

That should work with a normal PmWiki setup, provided that you have no
page names that include the - character. Note that this'll map a file
with an internal name like "Group.PageABC" to a url
"/group/page-a-b-c".

eemeli



More information about the pmwiki-users mailing list