[pmwiki-users] Re: Unifying variables, attributes, properties, part 2 (attributes)

Patrick R. Michaud pmichaud at pobox.com
Thu Dec 15 19:17:56 CST 2005


On Fri, Dec 16, 2005 at 01:34:35AM +0100, chr at home.se wrote:
> > That's a good idea, then the trail markup could be designed to
> > convert
> >     <<|SomePage|>>
> > to
> >     << {<$Title} | SomePage | {>$Title} >>
> 
> Here I don't understand how the '{$<Title}' is interreted in a context so 
> that it knows *which* list of pages it should work with.

At present the trail markup works by substituting the page links
read directly from the trail.  This is currently a hard-coded constant; 
i.e., there's no way for an admin to change the format of what is
being produced except by creating a custom trail function.  I'm
fudging a few unimportant details here for clarity, but the current
code does something like:

  return "<< $prev | $trailname | $next >>";

I'm thinking that the trail markup will instead $prev, $trailname, and
$next into $FmtV[] as $PrevLink, $TrailLink, and $NextLink.  Then the the 
trail output becomes configurable:

  SDV($TrailMarkupFmt, '<< $PrevLink | $TrailLink | $NextLink >>');
  return FmtPageName($TrailMarkup, $pagename);

However, in addition to setting the $FmtV variables, the trail markup
function can also set the current cursor:

  $Cursor['<'] = $t[$i-1]['pagename'];    # previous page on trail
  $Cursor['='] = $t[$i  ]['pagename'];    # current page on trail
  $Cursor['>'] = $t[$i+1]['pagename'];    # next page on trail

Then, an admin can redefine the trail markup as:

  $TrailMarkupFmt = '<< [[{<$FullName}|+]] | $TrailLink | [[{>$FullName}|+]] >>'

which uses the titles of the previous and next pages.  Of course, this
also gives the admin the opportunity to add custom spans, rel values, etc.
into the trail output.

Does that help?  Basically any markup or construct can set its own idea
of the current "cursor", which is then used for any page variable
substitutions that are in the scope of that markup.  (If a markup doesn't
set a cursor, then any existing cursor is used.)

Pm





More information about the pmwiki-users mailing list