[Pmwiki-users] Nested pages - how?

Patrick R. Michaud pmichaud
Sun Jun 20 08:44:16 CDT 2004


On Sun, Jun 20, 2004 at 09:56:06AM -0400, J. Perkins wrote:
> I took a look at the new PmWiki code yesterday, in the hope of 
> integrating my nested pages code. I'm afraid that I couldn't figure 
> where to hook my code in. Patrick, if it isn't too much trouble, could 
> you give me a couple of pointers?

Sure.  The key routine is MakePageName($pagename,$x), which converts any
string $x into a valid PmWiki pagename.  For relative links $pagename is
the page that $x is relative to.  MakePageName can be customized via
$MakePageNameFunction, which should name a function having the same
arguments.

The default definition of MakePageName handles PmWiki's one-level group
structure and freelinks.  Here are a few examples using the current 
version of MakePageName:

MakePageName('Main.HomePage','WikiSandbox')         => 'Main.WikiSandbox'
MakePageName('Main.HomePage','wiki sandbox')        => 'Main.WikiSandbox'
MakePageName('Main.HomePage','my+new^page')         => 'Main.MyNewPage'
MakePageName('Main.HomePage','PmWiki.SomePage')     => 'PmWiki.SomePage'
MakePageName('Main.HomePage','pm wiki / some page') => 'PmWiki.SomePage'
MakePageName('PmWiki.PmWiki','WikiSandbox')         => 'PmWiki.WikiSandbox'

The interesting case is when the $x string contains "multiple groups", as
in MakePageName('Main.HomePage','Alpha.Beta.Gamma').  The current 
version ignores 'nested groups' altogether, returning 'Beta.Gamma' as
the pagename.  A previous version I played with automatically 
concatenated the group names together, resulting in 'AlphaBeta.Gamma',
and this worked fine but was a bit confusing to others.

There's nothing to prevent a custom $MakePageNameFunction from returning 
hierarchical page names such as 'Alpha.Beta.Gamma', and this will generally
work fine.  Relative page links would be interpreted by the custom 
MakePageName function, so it's entirely up to the function author to
decide how relative links are to be handled.  However, the issues of 
group headers, group footers, and hierarchical page permissions would 
still have to be resolved.

Pm



More information about the pmwiki-users mailing list