summaryrefslogtreecommitdiff
path: root/platform/www/lib/plugins/blog/syntax/draft.php
blob: 239f0c2597110158955c15c2e1297255cfdcb720 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
 * Blog Plugin, draft component: marks the current page as draft
 *
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Esther Brunner <wikidesign@gmail.com>
 */

class syntax_plugin_blog_draft extends DokuWiki_Syntax_Plugin {

    function getType() { return 'substition'; }
    function getSort() { return 99; }

    function connectTo($mode) {
        $this->Lexer->addSpecialPattern('~~DRAFT~~', $mode, 'plugin_blog_draft');
    }

    function handle($match, $state, $pos, Doku_Handler $handler) {
        return true;
    }

    /**
     * The only thing this plugin component does is to set the metadata 'type' to 'draft'
     */
    function render($mode, Doku_Renderer $renderer, $data) {
        if ($mode == 'xthml') {
            return true; // don't output anything
        } elseif ($mode == 'metadata') {
            $renderer->meta['type'] = 'draft';
        }
    }
}
// vim:ts=4:sw=4:et:enc=utf-8: