xref: /plugin/include/syntax/closelastsecedit.php (revision 0fd81891633ad24150fa8d2c8a3459ee16f1f598)
1<?php
2/**
3 * Include plugin (close last section edit)
4 *
5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author  Michael Hamann <michael@content-space.de>
7 */
8
9if (!defined('DOKU_PLUGIN'))
10    define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
11
12class syntax_plugin_include_closelastsecedit extends DokuWiki_Syntax_Plugin {
13
14    function getType() {
15        return 'formatting';
16    }
17
18    function getSort() {
19        return 50;
20    }
21
22    function handle($match, $state, $pos, Doku_Handler &$handler) {
23        // this is a syntax plugin that doesn't offer any syntax, so there's nothing to handle by the parser
24    }
25
26    /**
27     * Finishes the last open section edit
28     */
29    function render($mode, Doku_Renderer &$renderer, $data) {
30        if ($mode == 'xhtml') {
31            /** @var Doku_Renderer_xhtml $renderer */
32            list($endpos) = $data;
33            $renderer->finishSectionEdit($endpos);
34            return true;
35        }
36        return false;
37    }
38}
39// vim:ts=4:sw=4:et:
40