[dokuwiki] Re: Mixture of syntax and action plugin wanted - how to do this?

  • From: Michael Hamann <michael@xxxxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Mon, 6 Feb 2012 18:17:06 +0100

Hi,

On Mon, Feb 6, 2012 at 5:45 PM, Chris Green <cl@xxxxxxxx> wrote:
> It's a syntax plugin in that I need to extract some information from the
> wiki text using the syntax plugin connectTo() function, but then it's an
> action plugin because I only want to do something with the extracted
> text when the page it's on has been edited (or created).
>
> Is there any mechanism for handing data between them?  I need to extract
> the text and put it somewhere so that an action plugin triggered by
> (say) IO_WIKIPAGE_WRITE can handle it.

You could render that information as metadata, then you can request
that metadata from other places in the code. However that metadata
will only be available after actually saving the page and maybe not in
the same request as the one in which the page is saved. Furthermore
you might want to take external edits into consideration. One
possibility would be to hook into the indexer for doing this if the
information doesn't need to be immediately processed. I'm not sure if
this is for the same thing you've mentioned in your other mail, but if
it is, I would recommend writing to your database in the meta data
renderer. It is important that you only write data when metadata is
rendered and not when the xhtml is rendered as xhtml is also rendered
for previews or old revisions, but metadata is not.

Michael
--
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: