[pmwiki-users] Dynamically modifying page

V.Krishn vkrishn at insteps.net
Tue May 25 16:43:50 CDT 2010

On Wednesday 26 May 2010 1:39:37 am Hans wrote:
> Tuesday, May 25, 2010, 8:03:02 PM, V.Krishn wrote:
> > I have a directive at the beginning of a wiki page.
> > I would want the directive to dynamically modify at run-time the
> > remaining wiki content of the page and then let pmwiki process it.
> Your example is specific to style, not content.
> If you just wish to manipulate the style of elements
> via a directive you could look at
> http://www.pmwiki.org/wiki/Cookbook/CSSInWikiPages

I was thinking more in terms of server side dynamic manipulation of wiki 
before output. Inserting class was just an example.

> Otherwise, if you really want to manipulate content
> via a directive, you could do something more general
> on the page text by creating a Markup rule which should be called
> early in the rendering process, earliest being '_begin'.
> This should then manipulate the text, return the altered text content,
> and have the markup rules restarted via PRR(), so all markup
> in the text can be processed.
> An example which grabs all text from directive (:filterall:) onwards
> till end:
> Markup('filterall', '_begin', '/\\(:filterall:\\)(.*?)$/se',
>    "PRR(AllTextMarkup(\$pagename, PSS('$1')))");
> function AllTextMarkup($pagename, $text) {
>    .....do something with $text here....
>    return $text;
> }

Thanks Hans.
This does seem to solve the problem I have.
I am little scared of inserting a custom algo at the beginning of page process 
sequence, still not fully aware of its impact with other recipes.

A second query:
Does PmWiki still processes the text within (:if:) conditions,
when the conditions fail?

> cheers,
>   ~Hans


More information about the pmwiki-users mailing list