1<?php
2/**
3 * iReflect Plugin
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     i-net software <tools@inetsoftware.de>
7 * @author     Gerry Weissbach <gweissbach@inetsoftware.de>
8 */
9
10if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
11if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
12
13/**
14 * All DokuWiki plugins to extend the parser/rendering mechanism
15 * need to inherit from this class
16 */
17class syntax_plugin_nodetailsxhtml_forcetoc extends DokuWiki_Syntax_Plugin {
18
19    function getInfo() {
20        if ( method_exists(parent, 'getInfo')) {
21            $info = parent::getInfo();
22        }
23        return array_merge(is_array($info) ? $info : confToHash(dirname(__FILE__).'/../plugin.info.txt'), array(
24                        'desc' => 'Force the TOC to be inserted',
25        ));
26    }
27
28    function getType(){ return 'substition';}
29
30    function getSort(){ return 230; }
31
32    function connectTo($mode) {
33        $this->Lexer->addSpecialPattern('~~forceTOC~~', $mode, 'plugin_nodetailsxhtml_forcetoc');
34    }
35
36    function handle($match, $state, $pos, Doku_Handler $handler) {
37        return $match;
38    }
39
40    function render($mode, Doku_Renderer $renderer, $data) {
41        global $ID, $INFO;
42
43        $renderer->info['forceTOC'] = true;
44        $renderer->info['toc'] = true;
45        $renderer->meta['internal']['forceTOC'] = true;
46        return true;
47    }
48}
49
50//Setup VIM: ex: et ts=4 enc=utf-8 :