[dokuwiki] Re: writing a syntax plugin
- From: Chris Smith <chris@xxxxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Tue, 19 Jun 2007 09:46:10 +0100
domas wrote:
And, continuing the topic of complex syntaxes, can a plugin store
information, collected during multiple handle(...) calls, when rendering
a single page? Like collect all the items in <blockA>, process them
(e.g. sort) and only then render.
Theoretically. If you look in the handler (inc/parser/handler.php)
you'll find a nested syntax class. iirc footnotes makes use of it. A
plugin should be able to make use of the same system. Implementation
may be a little more tricky as its not as straightforward for a plugin
to write its own instructions AND to avoid DW having writing plugin
instructions.
Just wanted to clarify one thing - the plugin object is instantiated
when parsing a wiki page and destroyed only when the page has been
rendered? would it be possible then to store collected information in
class properties? Or is this a wrong approach? The documentation is a
bit unclear about this.
Thanks,
Domas
Its the wrong approach. The handler is called extremely rarely. Read
the sections on caching in both the syntax plugin documentation and the
caching documentation itself. Strictly the nested class isn't a syntax
mode but a call rewriter, the parser documentation page should explain
more about that.
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
- References:
- [dokuwiki] writing a syntax plugin
- From: domas
- [dokuwiki] Re: writing a syntax plugin
- From: Chris Smith
- [dokuwiki] Re: writing a syntax plugin
- From: domas
Other related posts:
- » [dokuwiki] writing a syntax plugin
- » [dokuwiki] Re: writing a syntax plugin
- » [dokuwiki] Re: writing a syntax plugin
- » [dokuwiki] Re: writing a syntax plugin
Theoretically. If you look in the handler (inc/parser/handler.php) you'll find a nested syntax class. iirc footnotes makes use of it. A plugin should be able to make use of the same system. Implementation may be a little more tricky as its not as straightforward for a plugin to write its own instructions AND to avoid DW having writing plugin instructions.And, continuing the topic of complex syntaxes, can a plugin store information, collected during multiple handle(...) calls, when rendering a single page? Like collect all the items in <blockA>, process them (e.g. sort) and only then render.
Just wanted to clarify one thing - the plugin object is instantiated when parsing a wiki page and destroyed only when the page has been rendered? would it be possible then to store collected information in class properties? Or is this a wrong approach? The documentation is a bit unclear about this. Thanks, Domas
- [dokuwiki] writing a syntax plugin
- From: domas
- [dokuwiki] Re: writing a syntax plugin
- From: Chris Smith
- [dokuwiki] Re: writing a syntax plugin
- From: domas