[pmwiki-users] Markup() Abuse Recommendations.

Stirling Westrup sti at pooq.com
Sun Oct 22 19:11:25 CDT 2006

I've been working on a V2.0 replacement for the Acronym cookbook recipe
(as well as adding a half-dozen features I've wanted myself). Its now
mostly written, but I've run into a snag.

I have an array of regex keys and their corresponding replacements. I
can easily imagine it growing to several hundred entries. I need to
enter each of these into the Markup() function while ensuring that they
are executed in the order they are given.  Now, I can imagine doing
something like this:

$i = 0;
$last = inline;
$base = 'MyName:';
foreach($patterns as $pat => $rep)
  { $name = $base.$i++;

    $last = ">$name";

The question is: is this the best way? Ideally I would prefer to add a
single markup rule for the whole array, not individually like this, but
I'm sure I can't do something like

    ( 'inline'
    , 'MyName'
    , array_keys($patterns)
    , array_values($patterns)

although thats actually what I want.

I'm also not sure that this is the correct way to ensure the ordering I
need. I fear it will really slowdown the markup engine to have such long
chains of dependencies, but I don't know of a better way.

Any ideas anyone?

More information about the pmwiki-users mailing list