[pmwiki-users] Same name but different pages if case sensitive

Bernd Schatz bernd.schatz at gmx.net
Wed Apr 29 20:55:52 CDT 2015


Hi,

Am 25.04.2015 um 18:50 schrieb Wolfgang Faust:> PPRA() checks if the replacement is a callable, and uses
> preg_replace_callback if necessary. Instead of using /e in the pattern,
> make the replacement an anonymous function, like so:
> $MakePageNamePatterns = array(
>      "/([\\w])+/" => function($match) {
>         return strtolower($match[1]); # all lowercase
>     },
>     "/\\s+/" => ''                          # remove spaces
> );


Great, that was it:

$MakePageNamePatterns = array(
     "/(^\w)(\w+)/" => function($match)
     {
           return strtoupper($match[1]).strtolower($match[2]); # all lowercase, except first character
     },
    "/\\s+/" => ''                          # remove spaces
);


To fix already existing pages in directory wiki.d ==>
for i in $(ls -1); do mv $i  $(echo $i | sed -e 's/Main\.\(\w\)\(.*\)/Main.\U\1\L\2/g'); done;


To fix special pages (hard coded anywhere ???) ==>
ln -s Main.Sidebar Main.SideBar


Now there is still a small issue with the PmWiki.* and Site.* pages,
but i think you could fix it with a small script that creates a link for every of this pages.


thx and greets 

  Bernd





-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20150430/3807c388/attachment.bin>


More information about the pmwiki-users mailing list