[pmwiki-users] Noobie Question: PmWiki 2.0 Categories

Patrick R. Michaud pmichaud at pobox.com
Wed Feb 23 18:33:52 CST 2005


This is an excellent thread/post.  However, I do have a few
observations...


On Thu, Feb 24, 2005 at 12:48:35PM +1300, John Rankin wrote:
> On Thursday, 24 February 2005 11:49 AM, David Jackson wrote:
> >
> >John Rankin wrote:
> >>Here is what I did and why.
> >>1. changed GroupFooter to contain
> >>    (:pagelist '!{$Title}':)

>From this I'm assuming that you're wanting to create a 
Category.GroupFooter page that automatically generates a list
of the pages in each category, as given by the category's name.

After reading through John's excellent post, it occurs to me that what
you really want is:

    (:pagelist {$FullName}:)

For any given category such as "Category.BreadAndPizza", this will
find all pages that contain "Category.BreadAndPizza" *or* that link
to Category.BreadAndPizza, through either the [[!BreadAndPizza]]
markup or by doing something like [[Category/BreadAndPizza]].  This
is because searches scan not only the markup text but also the names
of any pages that the markup links to.  

This has the desirable features of not accidentally finding pages
containing "bread", "and", "pizza", and you don't have to worry about
$SpaceWikiWords settings because we're always looking at the target
links.

Of course, there's still a problem if we have both [[!Bread]] and
[[!Bread and Pizza]] categories, in that doing a search for Category.Bread
will also accidentally grab the "and Pizza" items as well.  This problem
exists whether one uses (:pagelist {$FullName}:) or 
(:pagelist '!{$Title}':), because the search function doesn't look
for word boundaries at all -- it just does a simple substring match.

In the medium term I expect that PmWiki will be providing a
backlinks= option to (:pagelist:), such that one would be able
to write

    (:pagelist backlinks={$FullName}:)

and thereby find only those pages that link to the current page
(or category in this instance).  And if/when speed becomes an issue
for this, PmWiki will maintain a master "page cross-reference file" so 
that it doesn't have to read/scan all of the pages every time it needs to 
find the backlinks.

Continuing on...

> >Would {$Namespaced} return a non spaced name if wikiword spacing IS 
> >off?  

$Namespaced always has spaces, $Name never has spaces.
$Title uses the value of (:title:) as set in the page's markup, 
otherwise $Title defaults to either $Namespaced or $Name 
depending on $SpaceWikiWords.

Also, this indirectly points out that (:pagelist '!{$Title}':) won't
work correctly if the Category.BreadAndPizza page has a custom (:title:).

Pm



More information about the pmwiki-users mailing list