[pmwiki-users] Automated WikiTrails.

Stirling Westrup sti at pooq.com
Tue Aug 29 06:36:13 CDT 2006


Stirling Westrup wrote:
> Roman wrote:

>>> The intent is that all I need to do to add a new chapter to StoryTitle
>>> is to simply save it in the Stories group with its chapter number and it
>>> will gain an appropriate wikitrail while the StoryTitle page will be
>>> automatically updated.
>> If you put this to Site/LocalTemplates:
>>
>> [[#trailstory]]
>> (:if equal {$FullName} {=$FullName}:)%wikitrail%[[{<$FullName}|<<
>> Previous Story - {{<$FullName}$Title}]] | [[StoryTitle/]] |
>> [[{>$FullName}|Next Story - {{>$FullName}$Title} >>]](:if:)
>> [[#trailstoryend]]
>>
>> then this to Story GroupHeader
>>
>> (:pagelist name=StoryTitle.StoryTitle-* fmt=#trailstory:)
>>
>> and this to StoryTitle/
>>
>> (:pagelist name=StoryTitle.StoryTitle-*:)
>>
>> will it do what you want?
>>

I've now tried the above, and I can't get it to work right. The problem
is that if I put in a custom list= it needs to know the name of the
current page to work correctly.

Assume I have a Stories group with pages named StoryOne-01, StoryOne-02,
StoryOne-03, StoryTwo-01, StoryTwo-02, and so on.

If I use a custom list=chapters pagelist parameter defined like this:

  $SearchPatterns['chapters'][] = '/-\\d+$/';

Then I can indeed match all of the above without pulling in any of the
other pages in the Stories group. The trouble is, they all show up in
the SAME pagelist and so my dynamic wikitrail will link from the end of
one story to the start of the next. I don't want that. I want each trail
to be limited to its own story.

I tried using extended page vars to narrow things down to only match
pages with the same base as the current page, but it doesn't work. If I
try this:

(:set basename="{$Name:regreplace /-\d+$/ //}":)
(:pagelist list=chapters name={$basename}-* fmt=#trailstory:)

Then the pagelist is empty. I suspect that the pagelist is being invoked
before the (:set:) is executed, resulting in an argument of name=-*,
which will exclude everything.

Even if I could solve the above problem, there is also a problem with
the trailstory format definition as well. I need to strip off the ending
chapter number to get the name of the story so I can build a link to the
main page for the story. Again, I thought something involving regreplace
would work, but I run into the exact same problem.

At this point its looking like I might need to write a custom fmt
handler in php to get this working, but that's a lot messier (and harder
to modify) than I would like.

Does anyone have any good ideas how to solve this?




More information about the pmwiki-users mailing list