[dokuwiki] syntax plugin question wrt handle() vs render()

  • From: Mike Frysinger <vapier@xxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sun, 9 Mar 2008 18:54:58 -0500

i'm trying to write a plugin that takes input like:
<register>
key1 = value1
key2 = value2
key3 = value3
</register>
the plugin uses the values to generate an image (the different keys represent 
different pieces of the final image).

going through the documentation, it seems i should be doing:
 - connectTo():
        - addEntryPattern("<register>", ....
  - postConnect():
        - addPattern("key1 = ", ...
        - addPattern("key2 = ", ...
        - addPattern("key3 = ", ...
        - addExitPattern("</register>", ...

and then the handle() function gets called multiple times:
 - ($state, $match) = (ENTER, "")
 - ($state, $match) = (MATCHED, "key1 = ")
 - ($state, $match) = (UNMATCHED, "value1")
 - ($state, $match) = (MATCHED, "key2 = ")
 - ($state, $match) = (UNMATCHED, "value2")
 - ($state, $match) = (MATCHED, "key3 = ")
 - ($state, $match) = (UNMATCHED, "value3")
 - ($state, $match) = (EXIT, "")

the idea was for the handle() function to create an associative array of 
[key#] => [value#] and then have that be passed to render(), but it would 
seem like that's not possible ?  i would have to maintain state across 
MATCHED/UNMATCHED calls ... is that what the &$handler parameter is for ?
-mike

Other related posts: