1<?php
2if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
3if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
4require_once(DOKU_PLUGIN.'syntax.php');
5
6class syntax_plugin_inblock_ranges extends DokuWiki_Syntax_Plugin {
7
8    function getInfo(){
9        return array(
10            'author' => 'Troy Rollo',
11            'email'  => 'dokuwiki@troy.rollo.name',
12            'date'   => '2006-03-27',
13            'name'   => 'In-block range protection',
14            'desc'   => 'Provide for a "formatting" construct that protects in-block ranges from parsing bugs',
15            'url'    => 'http://wiki.splitbrain.org/plugin:complex_lists'
16        );
17    }
18
19    function syntax_plugin_inblock_ranges(){
20    }
21
22    function getAllowedTypes()
23    {
24	return array('formatting', 'substitution');
25    }
26
27    function getType(){
28        return 'formatting';
29    }
30
31    function getSort(){
32        return 15;
33    }
34
35    function connectTo($mode) {
36	$this->Lexer->addEntryPattern('#[(]', $mode, 'plugin_inblock_ranges');
37    }
38
39    function postConnect() {
40	$this->Lexer->addExitPattern('[)]#', 'plugin_inblock_ranges');
41    }
42
43    function handle($match, $state, $pos, &$handler){
44        return array($state, $match);
45    }
46
47    function render($mode, &$renderer, $data) {
48	if ($data[0] == DOKU_LEXER_UNMATCHED)
49		$renderer->doc .= $data[1];
50        return false;
51    }
52
53}
54
55//Setup VIM: ex: et ts=4 enc=utf-8 :
56?>
57