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/');
12require_once(DOKU_PLUGIN.'syntax.php');
13
14/**
15 * All DokuWiki plugins to extend the parser/rendering mechanism
16 * need to inherit from this class
17 */
18class syntax_plugin_nodetailsxhtml_forcetoc extends DokuWiki_Syntax_Plugin {
19
20    function getInfo() {
21        if ( method_exists(parent, 'getInfo')) {
22            $info = parent::getInfo();
23        }
24        return array_merge(is_array($info) ? $info : confToHash(dirname(__FILE__).'/../plugin.info.txt'), array(
25                        'desc' => 'Force the TOC to be inserted',
26        ));
27    }
28
29    function getType(){ return 'substition';}
30
31    function getSort(){ return 230; }
32
33    function connectTo($mode) {
34        $this->Lexer->addSpecialPattern('~~forceTOC~~', $mode, 'plugin_nodetailsxhtml_forcetoc');
35    }
36
37    function handle($match, $state, $pos, Doku_Handler $handler) {
38        return $match;
39    }
40
41    function render($mode, Doku_Renderer $renderer, $data) {
42        global $ID, $INFO;
43
44        $renderer->info['forceTOC'] = true;
45        $renderer->info['toc'] = true;
46        $renderer->meta['internal']['forceTOC'] = true;
47        return true;
48    }
49}
50
51//Setup VIM: ex: et ts=4 enc=utf-8 :