[Pmwiki-users] Custom Markup processing

Patrick R. Michaud pmichaud
Tue Nov 9 06:31:27 CST 2004


On Mon, Nov 08, 2004 at 06:45:40PM -0500, Neil Vachharajani wrote:
> I was trying to generate some custom markup, and was excited to see
> the easy extension mechanism with the [[ ]] syntax.  My problem is
> that if the text replaced by the [[ ]] (when the key in the
> $DoubleBrackets array is a regular expression) contains newlines, it
> does not get exploded into seperate lines.  

Actually, this has been changed in PmWiki 2.0 (http://www.pmwiki.org/pmwiki2).
In PmWiki 2.0, if a replacement results in newlines (or other directives!)
that need to be reprocessed by the markup, one simply makes a call to
PRR() to get PmWiki to start reprocessing things from the beginning:

    Markup('makelist','directives','/\\(:makelist:)\\/e',
      'FunctionToGenerateList().PRR()');

> I modified pmwiki.php so that it takes a line which has just been
> through the $DoubleBrackets processing and re-expands it into seperate
> lines and does the remaining pmwiki.php processing on these lines.  Is
> there a reason why this is bad or wasn't being done before?  

Just because in developing the early versions of PmWiki code I wanted to 
avoid the potential for surprise interactions between multiple instances 
of $DoubleBrackets.

At any rate, it's handled differently (better) in PmWiki 2 -- now any
markup sequence (directives, double brackets, inline markup, block markup,
links) can result in having the entire result string reprocessed.

(Also, PmWiki 2 recommends using (:...:) for directives, reserving the
double-brackets syntax for creating links.)

Thanks!

Pm




More information about the pmwiki-users mailing list