xref: /plugin/siteexport/syntax/toctools.php (revision 06a81c5c13899619df335f5cb5dc095c74e8f29b)
1<?php
2/**
3 * Siteexport 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_siteexport_toctools extends DokuWiki_Syntax_Plugin {
19
20    /**
21     * What kind of syntax are we?
22     */
23    function getType() {
24        return 'substition';
25    }
26
27    /**
28     * What kind of syntax are we?
29     */
30    function getPType() {
31        return 'block';
32    }
33
34    /**
35     * Where to sort in?
36     */
37    function getSort() {
38        return 999;
39    }
40
41
42    /**
43     * Connect pattern to lexer
44     */
45    function connectTo($mode) {
46        // not really a syntax plugin
47    }
48
49    /**
50     * Handle the match
51     */
52    function handle($match, $state, $pos, Doku_Handler $handler){
53        // not really a syntax plugin
54    }
55
56    /**
57     * Create output
58     */
59    function render($mode, Doku_Renderer $renderer, $data) {
60        if ($mode == 'xhtml') {
61            list( $type, $pos, $title, $id ) = $data;
62            if ( $type == 'mergehint' ) {
63                if ( $pos == 'start' ) {
64                    $renderer->doc .= '<!-- MergeHint Start for "' . $title . '" -->';
65                    $renderer->doc .= '<div id="' . $id . '" class="siteexport mergehintwrapper"><aside class="mergehint">' . $title . '</aside><div class="mergehintcontent">';
66                } else {
67                    $renderer->doc .= '</div></div>';
68                    $renderer->doc .= '<!-- MergeHint End for "' . $title . '" -->';
69                }
70            } else {
71                $renderer->doc .= "<br style=\"page-break-after:always;\" />";
72            }
73            return true;
74        }
75        return false;
76    }
77}
78
79//Setup VIM: ex: et ts=4 enc=utf-8 :