[pmwiki-users] Re: Re: Re: Re: Dynamic wiki trails

chr at home.se chr at home.se
Thu Mar 17 04:33:22 CST 2005


On 17 Mar 2005, John Rankin wrote:

> Will do... Just one more comment:
> The advantage of using [[!trail]] category labels is that we get the
> category features for free. Otherwise, we have to introduce a new
> directive so pmwiki can find all the trail pages.

Anyway, I think you're right... there should be no special "directive"  
(or special category either) for tagging a pages on a trail. I should
point out that I think a '!' is needed to separate (:trail xyz:) from
(:trail !xyz:), where the former just refers to the page, and the latter
refers to the category. Here (:trails !catA:) is supposed to generate the
list of all pages in catA and use this list as the *trail map*. This trail 
map is then checked against the current page to see if/how a trail link 
should be generated.

We could however be (too?) clever and introduce

	(:trails !!catA:) 

which would take this a step further... It would first generate a list of
all pages in catA, but then use this list as a list of *trail maps*...
Each of these trail maps would then be checked against the current page.
Can you say time consuming? :-)

Anyway, this indirect approach is probably doable with some kind of
indexing scheme.. but I'm doubtful we can make it recursive... 
I'll now use your example to illustrate how the above would work.

We have these pages:
TrailPage1 contains:		* [[Page-1a]]
				* [[Page-1b]]
				[[!trailA]]

TrailPage2 contains:		* [[Page-2a]]
				* [[Page-2a]]
				[[!trailA]]

TrailPage3 contains:		* [[Page-3a]]
				* [[Page-3b]]
				[[!trailB]]

Category.TrailA contains:	[[!trail]]

Category.TrailB contains:	[[!trail]]

Below are some example directives and the corresponding trail map or list
of trail pages (trail map pages). Note the following distinction:
- If the result is a *trail map*, then the current page is simply checked
  against the list of pages in that trail map.
- If the result is a *list of trail pages*, then for each trail page,
  the current page is checked against the trail map in that trail page.

  Directive		   	Trail map or trail pages
* (:trails TrailPage1:)      => Trail page == [TrailPage1]
			     => Trail map  == (Page-1a, Page-1b)

* (:trails Category.TrailA:) => Trail page == [Category.TrailA]
				Trail map  == (TrailPage1, TrailPage2)

* (:trails !TrailA:)         => Trail page == [Category.TrailA]
				Trail map  == (TrailPage1, TrailPage2)

* (:trails !TrailB:)	     => Trail page == [Category.TrailB]
				Trail map  == (TrailPage3)

* (:trails !!TrailA:)        => Trail page == [TrailPage1, TrailPage2] 
				Trail map 1 == (Page-1a, Page-1b)
				Trail map 2 == (Page-2a, Page-1b)

* (:trails !!trail:)         => Trail page == [Cat..TrailA, Cat..TrailB] 
				Trail map 1 == (TrailPage1, TrailPage2)
				Trail map 2 == (TrailPage3)

In the last example, (:trails !!trail:), we do not get an extra level 
of indirection so it is not possible to use (:trails !!trail:) to generate 
a list of *all* trail pages this way. For that to happen, all trail pages 
would have to contain [[!trail]] in this case.

This might be overkill, but you could imagine using (:trails !!!trail:) 
for that extra level of indirection...

> In other words: (:trails xyz:) can works for wiki categories
> *and* wiki trails. That is cool! This may have been obvious 
> to you, it has just taken me a while to arrive.

Guess I wasn't very clear, since that was one of my goals *lol*.

/Christian

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr





More information about the pmwiki-users mailing list