From ee20e7d16637625e900f518b6b46a61bfa30fe6e Mon Sep 17 00:00:00 2001 From: andi Date: Thu, 19 May 2005 22:10:09 +0200 Subject: first attempt of syntax plugins The first version of the new plugin system. Syntax plugins only yet. A very simple example plugin called info (doing nothig useful yet) is included. Missing Features - Doku_Block_Handler needs work (doesn't honur plugins yet) - there is no way to specify the order of plugins and other modes yet - useful output from the info plugin - bug testing and fixing - code cleanup - documentation darcs-hash:20050519201009-9977f-f793dbfc6a39d8a9643b610927d93cd3288bdd6b.gz --- inc/parser/handler.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'inc/parser/handler.php') diff --git a/inc/parser/handler.php b/inc/parser/handler.php index e1ded183a..2379d60ff 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -54,6 +54,25 @@ class Doku_Handler { } return FALSE; } + + + /** + * Special plugin handler + * + * This handler is called for all modes starting with 'plugin_'. + * An additional parameter with the plugin name is passed + * + * @author Andreas Gohr + */ + function plugin($match, $state, $pos, $pluginname){ + $data = array($match); + $plugin = null; + if(plugin_load('syntax',$pluginname,$plugin)){ + $data = $plugin->handle($match, $state, $pos, $handler); + } + $this->_addCall('plugin',array($pluginname,$data,$pos),$pos); + return TRUE; + } function base($match, $state, $pos) { switch ( $state ) { -- cgit v1.2.3