[dokuwiki] Re: writing a syntax plugin
- From: Chris Smith <chris@xxxxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Tue, 19 Jun 2007 03:01:40 +0100
domas wrote:
Hi,
I am trying to grasp development of dokuwiki plugins and have a few
questions:
if I wanted to write a container plugin with a more complex syntax:
<blockA>
<A>aaa</A>
<B>bbb</B>
</blockA>
is it better to add a single special pattern <blockA>.+?</blockA> or
have entry, exit and internal patterns?
That depends on whether you wish to allow other syntax modes within your
own syntax. If you do, then it is better to use entry, exit and
internal patterns. The only other alternative is to instantiate a
second parser to process the data you aren't interested in. Doing so
would be resource expensive and may be difficult to handle, especially
when you take into account the protected modes.
Is there perhaps an example of such a plugin - I spent half an hour
searching but couldn't find anything.
Try the list plugins.
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.
Aside - I've always felt the plugin handler() method should be able to
return a value that tells its caller not to write an instruction. It
may even be relatively painless to add that functionality without
disrupting existing plugin behaviour.
Thanks in advance,
Domas
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
- Follow-Ups:
- [dokuwiki] Re: writing a syntax plugin
- From: domas
- References:
- [dokuwiki] 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
Hi, I am trying to grasp development of dokuwiki plugins and have a few questions: if I wanted to write a container plugin with a more complex syntax: <blockA> <A>aaa</A> <B>bbb</B> </blockA> is it better to add a single special pattern <blockA>.+?</blockA> or have entry, exit and internal patterns?
Is there perhaps an example of such a plugin - I spent half an hour searching but couldn't find anything.
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.
Thanks in advance, Domas
- [dokuwiki] Re: writing a syntax plugin
- From: domas
- [dokuwiki] writing a syntax plugin
- From: domas