[pmwiki-users] Re: Page names with spaces (Was: case-insensitive file names

chr at home.se chr at home.se
Thu Sep 29 17:42:33 CDT 2005


On Thu, 29 Sep 2005, Patrick R. Michaud wrote:

> On Thu, Sep 29, 2005 at 06:42:35PM +0200, chr at home.se wrote:
> > On Thu, 29 Sep 2005, Patrick R. Michaud wrote:
> > 
> > >     Main.Abc               "_Main._Abc"
> > >     Main.ABC               "_Main._A_B_C"
> > >     Long.PageName          "_Long._Page_Name"
> > >     Long.Pagename          "_Long._Pagename"
> > >     LongGroup.LongerName   "_Long_Group._Longer_Name"
> > 
> > Looking at all the underscores, do you know of a cookbook recipe that 
> > let's you have page names with spaces in them?
> 
> There's http://www.pmwiki.org/wiki/Cookbook/AlternateNamingScheme,
> which takes a slightly different approach to the problem than how
> I'd do it now (mainly because it's based on an older devel or 
> beta release).
> 
> In current releases one can modify the $MakePageNamePatterns 
> array to customize the way that strings are converted into
> pagenames.  Currently the default sequence is:
> 
>     "/'/" => '',                           # strip single-quotes
>     "/[^$PageNameChars]+/" => ' ',         # convert non-alnums to spaces
>     "/((^|[^-\\w])\\w)/e" 
>       => "strtoupper('$1')",               # initial caps after spaces
>     "/ /" => ''                            # strip spaces
> 
> We can set the sequence so that the last rule instead reads:
> 
>     "/\\s+/" => '_'                        # Convert spaces to underscores
> 
> Thus, [[Documentation index]] becomes "Documentation_Index".
> 
> Similarly, the strtoupper rule can be omitted, which eliminates
> the automatic up-casing of letters, thus [[Documentation index]] 
> becomes "Documentation_index".  If the wiki can then do a 
> case-insensitive searches for the corresponding page file, 
> it'll work out fine.
> 
> There are probably a few other patterns that need adjusting
> here and there, but this the core of getting underscores to
> work.

I added some of this as a comment at the end of 
        http://www.pmwiki.org/wiki/Cookbook/AlternateNamingScheme
for future reference. (and I cc'd this to John).

/Christian

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr






More information about the pmwiki-users mailing list