1<?php
2
3
4/**
5 * Subject Index plugin : control macro
6 * ~~NOSUBJECTINDEX~~
7 *
8 * Removes the macro syntax from displayed page.
9 *
10 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
11 * @author   Symon Bent <hendrybadao@gmail.com>
12 *
13 */
14
15// must be run within Dokuwiki
16if (!defined('DOKU_INC')) die();
17
18if (!defined('DOKU_LF')) define('DOKU_LF', "\n");
19if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t");
20if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
21require_once(DOKU_PLUGIN.'syntax.php');
22
23
24
25class syntax_plugin_subjectindex_ignore extends DokuWiki_Syntax_Plugin {
26
27    function getType() {
28		return 'substition';
29	}
30
31	function getSort() {
32		return 305;
33	}
34
35	function getPType(){
36		return 'normal';
37	}
38
39
40	function connectTo($mode) {
41        $this->Lexer->addSpecialPattern('~~(?i)NOSUBJECTINDEX(?-i)~~', $mode, 'plugin_subjectindex_ignore');
42	}
43
44
45	function handle($match, $state, $pos, Doku_Handler $handler) {
46       // For use by indexer only in raw wiki text, not for display
47        return $match;
48	}
49
50
51	function render($mode, Doku_Renderer $renderer, $data) {
52        if ($mode == 'xhtml') {
53            $renderer->doc .= '';
54        } else {
55            return false;
56        }
57	}
58}
59