1<?php
2
3if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
4if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
5require_once(DOKU_PLUGIN.'syntax.php');
6
7/**
8 * All DokuWiki plugins to extend the parser/rendering mechanism
9 * need to inherit from this class
10 */
11class syntax_plugin_revealjs_footer extends DokuWiki_Syntax_Plugin {
12
13    public function getType() { return 'substition'; }
14    public function getSort() { return 32; }
15    public function getPType() { return 'normal'; }
16
17
18    /**
19     * Connect lookup pattern to lexer.
20     *
21     * @param $aMode String The desired rendermode.
22     * @return none
23     * @public
24     * @see render()
25     */
26    public function connectTo($mode) {
27        $this->Lexer->addSpecialPattern('{{no-footer}}', $mode, 'plugin_revealjs_footer');
28    }
29
30
31
32    /**
33     * Handler to prepare matched data for the rendering process.
34     *
35     * @param $aMatch String The text matched by the patterns.
36     * @param $aState Integer The lexer state for the match.
37     * @param $aPos Integer The character position of the matched text.
38     * @param $aHandler Object Reference to the Doku_Handler object.
39     * @return Integer The current lexer state for the match.
40     * @public
41     * @see render()
42     * @static
43     */
44    public function handle($match, $state, $pos, Doku_Handler $handler) {
45        $data = array();
46        $data['position'] = $pos;
47        return $data;
48    }
49
50    /**
51     * Handle the actual output creation.
52     *
53     * @param $aFormat String The output format to generate.
54     * @param $aRenderer Object A reference to the renderer object.
55     * @param $aData Array The data created by the <tt>handle()</tt>
56     * method.
57     * @return Boolean <tt>TRUE</tt> if rendered successfully, or
58     * <tt>FALSE</tt> otherwise.
59     * @public
60     * @see handle()
61     */
62    public function render($mode, Doku_Renderer $renderer, $data) {
63        if($mode == 'xhtml'){
64            if (is_a($renderer, 'renderer_plugin_revealjs')){
65                //slideshow: here we use the keyword, this will pasted
66                $renderer->next_slide_no_footer = true;
67            } else {
68                //normal wiki page
69                $renderer->wikipage_next_slide_no_footer = true;
70                $renderer->wikipage_next_slide_no_footer_position = $data['position'];
71            }
72            return true;
73        }
74        return false;
75    }
76}
77