[pmwiki-users] Noobie Question: PmWiki 2.0 Categories

John Rankin john.rankin at affinity.co.nz
Wed Feb 23 17:48:35 CST 2005


On Thursday, 24 February 2005 11:49 AM, David Jackson <dave at glossopian.co.uk> wrote:
>
>John Rankin wrote:
>>Here is what I did and why.
>>
>>1. changed GroupFooter to contain
>>
>>    (:pagelist '!{$Title}':)
>>  
>>
>This makes sense after reading the comments below :-)
>
>>Let's deconstruct the (:pagelist '!{$Title}':) directive...
>>
>>First, we have to wrap the search text in ' ... '. Otherwise,
>PmWiki looks for 'bread' or 'and' or 'pizza'. Most pages
>contain 'and' so the search returns most everything... With the
>quotes, it returns '!Bread and Pizza' exact matches.
>>  
>>
>So we need to add this to *all* markup, which will cater for both single 
>word categories, such as 'Horror', 'Comedy' *and* my multi-word example, 
>'Bread and Pizza'

Yes and using the GroupFooter approach means 'it just works' (TM)
everywhere -- we only have to set it up once.

OTOH, 'Bread and Pizza' could be 2 categories: 'Bread' and 'Pizza'.
Choosing a category vocabulary is not easy.
>
>>Second, we want a ! to eliminate pages that happen to contain
>'Bread and Pizza' in general text. 'This may not happen overnight, but it /will/ happen.'
>>  
>>
>So you're saying here that the bang (!) is a NOT operator?  I assumed it 
>was picked for the markup, not as some part of a RegEx type
>expression...

Um, no your first interpretation is correct. 
Let's do an example. PageA contains, inter alia, the following:

   ... why did the chicken cross the road? ...

PageB contains, inter alia:

   ... [[!chicken]]

We want our category pagelist to pick up PageB but omit PageA.

If we search for 'chicken' we find both. If, however, we search
for '!chicken' we only find PageB. Which is the result we want.
It is very unlikely that a page will contain '!chicken' outside
of category markup. If we want to be really, really sure, we
could search for '[[!chicken]]'.
>
>>Third, and the tricky bit... {$Name} returns BreadAndPizza.
>{$Title} returns BreadAndPizza if wikiword spacing is off and
>Bread and Pizza if wikiword spacing is on. You quite properly
>categorised French White Bread as [[!Bread and Pizza]] and you
>have wikiword spacing on, so we have to use {$Ttitle} in the
>pagelist to find it. We could (I think) also use {$Namespaced}.
>>  
>>
>Would {$Namespaced} return a non spaced name if wikiword spacing IS 
>off?  As an experiment, I turned off wikiword spacing, but all pages 
>still had spaces.  I'm guessing the {$Title} is hard coded into the page 
>at creation time, and if you change the option you need to re-save the 
>page to get the correct title, or worst case re-create it.

No, pmwiki is smarter than that. It generates $Title on demand.
If $SpaceWikiWords == 0, $Title = $Name;
if $SpaceWikiWords == 1, $Title = $Namespaced;

$Namespaced does what the name suggests -- spaces the $Name.

I think!!
>
>
>Thanks for your help & time, I hope I can repay the favours
>somehow.

No worries. This is a good opportunity to clean up the category
documentation.


-- 
JR
--
John Rankin






More information about the pmwiki-users mailing list