[pmwiki-users] Dynamically modifying page

Hans design5 at softflow.co.uk
Tue May 25 15:09:37 CDT 2010


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

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;
}

cheers,
  ~Hans




More information about the pmwiki-users mailing list