[pmwiki-devel] Markup Processing Order

Patrick R. Michaud pmichaud at pobox.com
Fri Jul 18 11:25:43 CDT 2008

On Fri, Jul 18, 2008 at 11:29:56AM -0400, DaveG wrote:
> I've created a markup which calls a function. I'm trying to override 
> $DefaultPageTextFmt, but if I do this inside the markup function the 
> override doesn't occur. Placing the code inside the main body of the 
> recipe works fine, but obviously triggers all the time, rather than when 
> the markup is used..
> I suspect I simply need to change the processing order of the markup 
> some how. Suggestions?

By the time the markup is being processed, it's too late to do anything
useful with $DefaultPageTextFmt.  $DefaultPageTextFmt determines what
text (markup) to use if a page doesn't exist -- thus it has to be
handled _before_ any markup processing takes place.

> Here's the markup:
>    Markup("pmgallery", 'inline', "/\\(:pmgallery\\s*(.*?):\\)/se", 
> "Keep(pmGallery(PSS('$1')))");
> And the override code:
>    $GLOBALS['DefaultPageTextFmt'] = '(:include {$Group}.pmPageNotFound:)';

What you may want to do instead is:

      '(:include {$Group}.pmPageNotFound $[{$SiteGroup}.PageNotFound:)');

This uses the pmPageNotFound page of the current group if it exists,
falling back to Site.PageNotFound if it doesn't.


More information about the pmwiki-devel mailing list