[pmwiki-users] recipes on core elements

Patrick R. Michaud pmichaud at pobox.com
Fri Sep 2 08:14:37 CDT 2005


On Thu, Sep 01, 2005 at 07:16:04PM -0400, Radu wrote:
> At 06:44 PM 9/1/2005, Joachim Durchholz wrote:
> >Radu schrieb:
> >> the markup table is processed almost
> >>entirely each time a new markup is declared...
> >
> >AFAIK it isn't. Markup table creation is a two-step process: first, 
> >PmWiki collects all the rules,
> 
> each time a markup is added that requires rearrangement (which are 
> quite a few):
>       foreach((array)@$MarkupTable[$id]['dep'] as $i=>$m)
>         Markup($i,"$m$id");

This doesn't reprocess the entire markup table, it only reprocesses
those rules where the sequencing depends on the current one.  In
a normal definition sequence such as

   Markup('[[', 'links', ..., ...);
   Markup('urllink', '>[[', ..., ...);
   Markup('wikilink', '>urllink', ..., ...);

then the above loop is always completely empty, because the 
position of each dependency is already known.  Where the loop
comes into play is only when a Markup is defined based on a rule that
hasn't been defined yet, as in
   
   Markup('wikilink', '>urllink', ..., ...);
   Markup('urllink', '>[[', ..., ...);
   Markup('[[', 'links', ..., ...);

But even here, only the specific dependencies are processed, not 
the entire table.  In other words, when the '[[' markup is defined, 
then at that point PmWiki positions the 'urllink' and 'wikilink' 
markups (and only those markups).

It would be possible to do the sequencing once after all of the
markups have been defined, but that is actually less efficient
overall because it builds a second processing pass for all
markups, whereas the above only does the second processing pass
for those markups where the sequence is not known when it's
initially defined.

Pm




More information about the pmwiki-users mailing list