[pmwiki-users] Hierarchical pages

Petko Yotov 5ko at 5ko.fr
Sun Apr 26 01:44:58 PDT 2020


On 26/04/2020 01:57, Michael Eager wrote:

>> * [[Maps/Europe]]
>> ** [[Maps/France]]
>> *** [[Paris/Paris]]
>> **** [[Paris/1950]]
>> **** [[Paris/2000]]
>> ** [[Maps/Germany]]
>> *** [[Berlin/Berlin]]
>> **** [[Berlin/1989]]
>> **** [[Berlin/2019]]
>> *** [[München/München]]
>> **** [[München/2019]]
> 
> This is a bit unnatural.  The pages are not really hierarchical and
> this requires editing multiple pages.  For example, to add a 2020
> entry to the Berlin page, I'd need to add a line to the Maps.Maps
> page, as well as edit the Berlin page.

Actually, for the structure and the breadcrumbs you only need to edit 
the wikitrail page.

You are not required to edit the Berlin page, or any other page, unless 
you want to link from that page to the new page.

> I'm not really familiar with WikiGroups, but they seem like a higher
> level construct, where they represent a large collection.  In my
> contrived example, one group might be Main.Maps, another group might
> be Main.Guides.

Oh, WikiGroups are simpler than that, and you are familiar with them. 
"Main", "Site", "SiteAdmin", "PmWiki" are WikiGroups in the default 
installation. So both Main.Maps and Main.Guides are "pages" in the group 
"Main".


> What I'm looking for is something more incremental and finer grained.
> 
> I attached a recipe named hlink.php which extends PmWiki's page links
> with a simple markup: [[*  (The Hg recipe has something similar,
> although not documented, and I wasn't able (and/or didn't spend the
> time) to figure out what it does.)
> 
> If I edit a page Main/Maps and add
>   [[*Europe]]
> this will create a link to [[Main/Maps-Europe]].  Creating this page 
> and adding
>   [[*France]]
> will create a link to [[Main/Maps-Europe-France]].  On the same page, 
> adding
>   [[*Germany]]
> will create a link to [[Main/Maps-Europe-Germany]].  And so on, with
> each new page name generated by appending it's name to the current
> page name separated by a hyphen.
> 
> A (:hbreadcrumb:) markup parses the current page name and generates a
> line with links to each of the parent pages, for example:
> 
>   Main>Maps>Europe>Germany>Berlin
> 
> One problem is that the hyphen has been used to separate pages in this
> hierarchical overlay.  Nothing prevents one from creating links like
>   [[*Garmish-Partenkirchen]]
> on the [[*Germany]] page, but the breadcrumb will be garbled.
> 
> Let me know what you think.

This looks cool.

Instead of "global $pagename;" I recommend to use

   extract($GLOBALS['MarkupToHTML']);

which will import the current $pagename passed by MarkupToHTML which may 
not be the same as the global $pagename.

> Is there another character which can be
> used as a separator?


If the wiki has UTF-8 enabled, I'll probably use an arrow like → or a 
middle dot · or a right quote » or some other Unicode character.

Because it is unlikely that your users' keyboards can easily type this 
Unicode character, I'd add a GuiEdit button with the character.

Petko



More information about the pmwiki-users mailing list