xref: /plugin/siteexport/syntax/toctools.php (revision a8c17ab5b37308343f86651acb8c4a1b3f36f0ae)
1300ce4a2SGerry Weißbach<?php
2300ce4a2SGerry Weißbach/**
3300ce4a2SGerry Weißbach * Siteexport Plugin
4300ce4a2SGerry Weißbach *
5300ce4a2SGerry Weißbach * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6300ce4a2SGerry Weißbach * @author     i-net software <tools@inetsoftware.de>
7300ce4a2SGerry Weißbach * @author     Gerry Weissbach <gweissbach@inetsoftware.de>
8300ce4a2SGerry Weißbach */
9300ce4a2SGerry Weißbach
10*a8c17ab5Si-net /// softwareif (!defined('DOKU_INC')) define('DOKU_INC', /** @scrutinizer ignore-type */ realpath(dirname(__FILE__) . '/../../') . '/');
11300ce4a2SGerry Weißbachif (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
12300ce4a2SGerry Weißbachrequire_once(DOKU_PLUGIN . 'syntax.php');
13300ce4a2SGerry Weißbach
14300ce4a2SGerry Weißbach/**
15300ce4a2SGerry Weißbach * All DokuWiki plugins to extend the parser/rendering mechanism
16300ce4a2SGerry Weißbach * need to inherit from this class
17300ce4a2SGerry Weißbach */
18300ce4a2SGerry Weißbachclass syntax_plugin_siteexport_toctools extends DokuWiki_Syntax_Plugin {
19300ce4a2SGerry Weißbach
20300ce4a2SGerry Weißbach    /**
21300ce4a2SGerry Weißbach     * What kind of syntax are we?
22300ce4a2SGerry Weißbach     */
23*a8c17ab5Si-net /// software    public function getType() {
24300ce4a2SGerry Weißbach        return 'substition';
25300ce4a2SGerry Weißbach    }
26300ce4a2SGerry Weißbach
27300ce4a2SGerry Weißbach    /**
28300ce4a2SGerry Weißbach     * What kind of syntax are we?
29300ce4a2SGerry Weißbach     */
30*a8c17ab5Si-net /// software    public function getPType() {
31300ce4a2SGerry Weißbach        return 'block';
32300ce4a2SGerry Weißbach    }
33300ce4a2SGerry Weißbach
34300ce4a2SGerry Weißbach    /**
35300ce4a2SGerry Weißbach     * Where to sort in?
36300ce4a2SGerry Weißbach     */
37*a8c17ab5Si-net /// software    public function getSort() {
38300ce4a2SGerry Weißbach        return 999;
39300ce4a2SGerry Weißbach    }
40300ce4a2SGerry Weißbach
41300ce4a2SGerry Weißbach
42300ce4a2SGerry Weißbach    /**
43300ce4a2SGerry Weißbach     * Connect pattern to lexer
44300ce4a2SGerry Weißbach     */
45*a8c17ab5Si-net /// software    public function connectTo($mode) {
46300ce4a2SGerry Weißbach        // not really a syntax plugin
47300ce4a2SGerry Weißbach    }
48300ce4a2SGerry Weißbach
49300ce4a2SGerry Weißbach    /**
50300ce4a2SGerry Weißbach     * Handle the match
51300ce4a2SGerry Weißbach     */
52*a8c17ab5Si-net /// software    public function handle($match, $state, $pos, Doku_Handler $handler){
53300ce4a2SGerry Weißbach        // not really a syntax plugin
54300ce4a2SGerry Weißbach    }
55300ce4a2SGerry Weißbach
56300ce4a2SGerry Weißbach    /**
57300ce4a2SGerry Weißbach     * Create output
58300ce4a2SGerry Weißbach     */
59*a8c17ab5Si-net /// software    public function render($mode, Doku_Renderer $renderer, $data) {
60300ce4a2SGerry Weißbach        if ($mode == 'xhtml') {
61300ce4a2SGerry Weißbach            list( $type, $pos, $title, $id ) = $data;
62300ce4a2SGerry Weißbach            if ( $type == 'mergehint' ) {
63300ce4a2SGerry Weißbach                if ( $pos == 'start' ) {
64300ce4a2SGerry Weißbach                    $renderer->doc .= '<!-- MergeHint Start for "' . $title . '" -->';
6506a81c5cSGerry Weißbach                    $renderer->doc .= '<div id="' . $id . '" class="siteexport mergehintwrapper"><aside class="mergehint">' . $title . '</aside><div class="mergehintcontent">';
66300ce4a2SGerry Weißbach                } else {
6706a81c5cSGerry Weißbach                    $renderer->doc .= '</div></div>';
68300ce4a2SGerry Weißbach                    $renderer->doc .= '<!-- MergeHint End for "' . $title . '" -->';
69300ce4a2SGerry Weißbach                }
70300ce4a2SGerry Weißbach            } else {
71300ce4a2SGerry Weißbach                $renderer->doc .= "<br style=\"page-break-after:always;\" />";
72300ce4a2SGerry Weißbach            }
73300ce4a2SGerry Weißbach            return true;
74300ce4a2SGerry Weißbach        }
75300ce4a2SGerry Weißbach        return false;
76300ce4a2SGerry Weißbach    }
77300ce4a2SGerry Weißbach}
78300ce4a2SGerry Weißbach
79300ce4a2SGerry Weißbach//Setup VIM: ex: et ts=4 enc=utf-8 :