On Mon, Oct 17, 2011 at 10:27:35AM +0100, Chris G wrote: > On Mon, Oct 17, 2011 at 01:36:28AM +0100, Christopher Smith wrote: > > > > On 16 Oct 2011, at 17:25, Guillaume Turri wrote: > > > > > Hi, > > > > > > 2011/10/14 Chris G <cl@xxxxxxxx> > > > Is it possible to re-parse some code from within a syntax plugin? > > > > > > > > > The hidden plugin[1] does it in two ways: > > > 1 - It parses the text in the first <hidden> tag. Here, it already has a > > > text to parse. It's done like this: > > > > $tab = array(); > > > > $parsedText = p_render('xhtml', p_get_instructions($rawText), $tab); > > > > > > I'm afraid it's not the most effective way to do it (like in "we're > > > launching a whole new parsing chain"); but it works. > > > > > > > The plugin base class has a method to do that, so usage in a syntax plugin > > would be > > > > $this->render('wiki text string'); > > > > http://phpxref.com/xref/dokuwiki/inc/plugin.php.source.html#l225 > > > OK, thanks, it just wraps up the p_get_instructions() but keeps the code > more modular and is also probably more future proof. > Except that it doesn't work and my knowledge of how classes work in PHP is insufficient. Doing:- $this->render('wiki text string'); in a syntax plugin just tries to call the plugin's own render:- function render($mode, &$renderer, $data) and of course produces a run time error. As far as I can see syntax plugins extend DokuWiki_Syntax_Plugin and DokuWiki_Syntax_Plugin extends Doku_Parser_Mode which seems to be a parent/top-level class. I'm not quite clear *what* the plugin base class is parent of. .... ah!! It should be:- $renderer->render('wiki text string'); Where $renderer is the second parameter passed into the plugin's render() function. -- Chris Green -- DokuWiki mailing list - more info at http://www.dokuwiki.org/mailinglist