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

  • From: Myron Turner <turnermm02@xxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Mon, 06 Feb 2012 12:43:33 -0600

On 2/6/2012 12:13 PM, Christopher Smith wrote:

On 6 Feb 2012, at 16:45, Chris Green wrote:

I'm trying to do something that seems to be a mixture of a syntax plugin
and an action plugin.
ere?

Follow the way you describe it.

You want to do something when the page is edited/created.  So, yes, hook into 
the IO_WIKIPAGE_WRITE.  Anywhere else and there is no guarantee you'll catch 
every save[1].

If you need to the page rendered to access the information you're after, call 
the parser to get it rendered. Metadata is a much lighter/faster renderer than 
xhtml.  If you're searching for data that can be easily found using strstr, 
preg_match or similar, then use those.

If you do call the parser there are any number of methods to exchange values 
between the action plugin&  syntax plugin.  The simplest is p_get_metadata 
(which calls the parser and returns a value) - but call it after the save!



My experience has been that if you place ~~NOCACHE~~ in a file, every time its content is changed, the syntax plugins contained in the file are activated. Which is why I thought that something like Chris Green wants could be dealt with wholly from within the syntax plugin itself. Perhaps I'm wrong, but if that is possible, it would make identifying what has to be saved much simpler.


--
Myron Turner
http://mturner.org/
http://mturner.org/fckgLite
https://github.com/turnermm
--
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: