xref: /plugin/siteexport/syntax/toctools.php (revision 300ce4a20f600a2031826a8c1d16bf3aa359b53d)
1*300ce4a2SGerry Weißbach<?php
2*300ce4a2SGerry Weißbach/**
3*300ce4a2SGerry Weißbach * Siteexport Plugin
4*300ce4a2SGerry Weißbach *
5*300ce4a2SGerry Weißbach * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6*300ce4a2SGerry Weißbach * @author     i-net software <tools@inetsoftware.de>
7*300ce4a2SGerry Weißbach * @author     Gerry Weissbach <gweissbach@inetsoftware.de>
8*300ce4a2SGerry Weißbach */
9*300ce4a2SGerry Weißbach
10*300ce4a2SGerry Weißbachif (!defined('DOKU_INC')) define('DOKU_INC', realpath(dirname(__FILE__) . '/../../') . '/');
11*300ce4a2SGerry Weißbachif (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
12*300ce4a2SGerry Weißbachrequire_once(DOKU_PLUGIN . 'syntax.php');
13*300ce4a2SGerry Weißbach
14*300ce4a2SGerry Weißbach/**
15*300ce4a2SGerry Weißbach * All DokuWiki plugins to extend the parser/rendering mechanism
16*300ce4a2SGerry Weißbach * need to inherit from this class
17*300ce4a2SGerry Weißbach */
18*300ce4a2SGerry Weißbachclass syntax_plugin_siteexport_toctools extends DokuWiki_Syntax_Plugin {
19*300ce4a2SGerry Weißbach
20*300ce4a2SGerry Weißbach    /**
21*300ce4a2SGerry Weißbach     * What kind of syntax are we?
22*300ce4a2SGerry Weißbach     */
23*300ce4a2SGerry Weißbach    function getType() {
24*300ce4a2SGerry Weißbach        return 'substition';
25*300ce4a2SGerry Weißbach    }
26*300ce4a2SGerry Weißbach
27*300ce4a2SGerry Weißbach    /**
28*300ce4a2SGerry Weißbach     * What kind of syntax are we?
29*300ce4a2SGerry Weißbach     */
30*300ce4a2SGerry Weißbach    function getPType() {
31*300ce4a2SGerry Weißbach        return 'block';
32*300ce4a2SGerry Weißbach    }
33*300ce4a2SGerry Weißbach
34*300ce4a2SGerry Weißbach    /**
35*300ce4a2SGerry Weißbach     * Where to sort in?
36*300ce4a2SGerry Weißbach     */
37*300ce4a2SGerry Weißbach    function getSort() {
38*300ce4a2SGerry Weißbach        return 999;
39*300ce4a2SGerry Weißbach    }
40*300ce4a2SGerry Weißbach
41*300ce4a2SGerry Weißbach
42*300ce4a2SGerry Weißbach    /**
43*300ce4a2SGerry Weißbach     * Connect pattern to lexer
44*300ce4a2SGerry Weißbach     */
45*300ce4a2SGerry Weißbach    function connectTo($mode) {
46*300ce4a2SGerry Weißbach        // not really a syntax plugin
47*300ce4a2SGerry Weißbach    }
48*300ce4a2SGerry Weißbach
49*300ce4a2SGerry Weißbach    /**
50*300ce4a2SGerry Weißbach     * Handle the match
51*300ce4a2SGerry Weißbach     */
52*300ce4a2SGerry Weißbach    function handle($match, $state, $pos, Doku_Handler $handler){
53*300ce4a2SGerry Weißbach        // not really a syntax plugin
54*300ce4a2SGerry Weißbach    }
55*300ce4a2SGerry Weißbach
56*300ce4a2SGerry Weißbach    /**
57*300ce4a2SGerry Weißbach     * Create output
58*300ce4a2SGerry Weißbach     */
59*300ce4a2SGerry Weißbach    function render($mode, Doku_Renderer $renderer, $data) {
60*300ce4a2SGerry Weißbach        if ($mode == 'xhtml') {
61*300ce4a2SGerry Weißbach            list( $type, $pos, $title, $id ) = $data;
62*300ce4a2SGerry Weißbach            if ( $type == 'mergehint' ) {
63*300ce4a2SGerry Weißbach                if ( $pos == 'start' ) {
64*300ce4a2SGerry Weißbach                    $renderer->doc .= '<!-- MergeHint Start for "' . $title . '" -->';
65*300ce4a2SGerry Weißbach                    $renderer->doc .= '<div id="' . $id . '" class="siteexport mergehint"><span class="mergehint">' . $title . '</span>';
66*300ce4a2SGerry Weißbach                } else {
67*300ce4a2SGerry Weißbach                    $renderer->doc .= '</div>';
68*300ce4a2SGerry Weißbach                    $renderer->doc .= '<!-- MergeHint End for "' . $title . '" -->';
69*300ce4a2SGerry Weißbach                }
70*300ce4a2SGerry Weißbach            } else {
71*300ce4a2SGerry Weißbach                $renderer->doc .= "<br style=\"page-break-after:always;\" />";
72*300ce4a2SGerry Weißbach            }
73*300ce4a2SGerry Weißbach            return true;
74*300ce4a2SGerry Weißbach        }
75*300ce4a2SGerry Weißbach        return false;
76*300ce4a2SGerry Weißbach    }
77*300ce4a2SGerry Weißbach}
78*300ce4a2SGerry Weißbach
79*300ce4a2SGerry Weißbach//Setup VIM: ex: et ts=4 enc=utf-8 :