On Mon, Oct 17, 2011 at 02:12:44AM +0100, Christopher Smith wrote: > The parser (lexer) effectively streams through the page. If your plugin, in > its handle() method, is seeing a string of wiki text ($match), the parser has > passed that string (its decided your plugin is the mechanism to deal with it > and handed it to your plugin's handle() method). Strictly you can't > (shouldn't) modify the stream. So if the parser has passed "<xv>Some > parameters</xv>" through to your plugin, its too late to replace "Some > parameters" with wiki text. > So what does getAllowedTypes() do? It appears to be saying that something like:- <xv>Some **bold** parameters</xv> works (and it does work generally). > If you want your plugin to create a string of wiki text, there should be one > question to answer first. Does the string of wiki text change for each page > edit or more frequently? > > If the wiki text changes for each page edit, then rather than render(), the > best method is to just figure out the wiki instructions > (p_get_instructions($rawText)) and nest them in your plugin's instruction. > This is similar to how footnotes are handled. > > If the wiki text changes more frequently than page editing, you should do > very little in your handle() method and use DokuWiki_Plugin::render()[1] from > within the plugin's render() method. DokuWiki caches the rendered page. If > the final output could vary more frequently than a wiki's cache settings, you > should either set the page to not be cached or include an accompanying action > plugin to handle PARSER_CACHE_USE and expire the cache when the previously > rendered output is no longer valid[2]. > I think many cases of what I'm doing fall into this last case. I'm using the 'parameters' of a wiki link ([[link?param1=abc¶m2=xyz]]) to pass values to substitute in my (and other) plugins. E.g. I have added code to the sql plugin such that I can do things like:- <sql db="sqlite:////var/www/wiki/data/meta/boat.db" wikitext="disable" position="vertical" special="myview" ..>SELECT Name, Description, River, Postcode, Population, Comments from Places where Name="@name@"</sql> Just have a link to the page that has the above code, put '?name=lille' in the link and I have a page that shows information for Lille. However I'm trying to expand on this ability by having a plugin manipulate the parameters before passing them on and that's what's producing all my questions. Putting the manipulation in the various 'destination' plugins is messy and means I have lots of modified plugins. I'd much rather keep all my extra code in one place and have standard versions of most plugins. -- Chris Green -- DokuWiki mailing list - more info at http://www.dokuwiki.org/mailinglist