[dokuwiki] Re: Plugin programming question - how to 're-parse' something?

  • From: Guillaume Turri <guillaume.turri@xxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sun, 16 Oct 2011 18:25:02 +0200

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.

2 - It lets parse the text between the <hidden> tags. It means in particular
that nested plugins may be used.
It's done  thanks to the getAllowedTypes() and accepts() functions

I think this second case is more likely to be what you are looking for.
I hope this information is useful.

Regards,
Guillaume

[1]: https://github.com/gturri/hidden/blob/master/syntax.php

Other related posts: