xref: /plugin/nodetailsxhtml/syntax/forcetoc.php (revision 0313ced8dd81b03a3b8e5e276844a6d805551407)
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	var $acronyms = array();
21	var $pattern = '';
22
23	function getInfo() {
24        if ( method_exists(parent, 'getInfo')) {
25            $info = parent::getInfo();
26        }
27	    return array_merge(is_array($info) ? $info : confToHash(dirname(__FILE__).'/../plugin.info.txt'), array(
28	    				'desc' => 'Force the TOC to be inserted',
29		));
30	}
31
32    function getType(){ return 'substition';}
33
34    function getSort(){ return 230; }
35
36    function connectTo($mode) {
37        $this->Lexer->addSpecialPattern('~~forceTOC~~', $mode, 'plugin_nodetailsxhtml_forcetoc');
38    }
39
40    function handle($match, $state, $pos, &$handler) {
41        return $match;
42    }
43
44    function render($mode, &$renderer, $data) {
45        global $ID, $INFO;
46
47        $renderer->info['forceTOC'] = true;
48        $renderer->info['toc'] = true;
49        $renderer->meta['internal']['forceTOC'] = true;
50        return true;
51    }
52}
53
54//Setup VIM: ex: et ts=4 enc=utf-8 :