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

  • From: Chris Green <cl@xxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Mon, 6 Feb 2012 18:09:57 +0000

On Mon, Feb 06, 2012 at 06:17:06PM +0100, Michael Hamann wrote:
> 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.
> 
Thanks for the pointers.  Yes, it is vaguely related to my other
questions, I'm just looking at ways to do things at present.

In reality I can probably get away with processing the data every time
the syntax plugin sees it, it's just that it jars somewhat knowing that
all this processing is wasted as it's only necessary when the data is
changed (i.e. when the page is edited).  As you say though this won't
catch extenal edits so maybe processing for every page 'show' action is
the way to go.

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

Other related posts: