[pmwiki-users] On a page name, is there a way to take dots after the first dot and translate them automatically

Patrick R. Michaud pmichaud at pobox.com
Mon Mar 4 10:13:27 CST 2013


On Mon, Mar 04, 2013 at 07:31:58AM -0800, ccox at endlessnow.com wrote:
> What I'd like to be able to do is to allow a construct like:
> 
> [[Product.Release 1.0]]
> 
> The first dot obviously is the Group separator... but I'd love for the
> next one to be "ok" and have it so that internally we map any subsequent
> set of "dots" to "dashes" (for example).  

At first glance I'd say it ought to be possible by either manipulating
$MakePageNamePatterns or setting $MakePageNameFunction to a custom
conversion function.  Of these two, easier would be to add an entry to
$MakePageNamePatterns to convert any second and subsequent dots to
hyphens.   If that doesn't work out, then you'll probably need
to create a custom $MakePageNameFunction (and copy a lot of the
code from MakePageName() ).

My first stab at a $MakePageNamePattern entry would be something like:

    '/(\..*)(\..*)$/e' => "'$1' . strtr('$2', '.', '-')"

Hope this helps.

Pm



More information about the pmwiki-users mailing list