1<?php
2/**
3 * PGP-Inline-Support Plugin
4 *
5 * @license    GPL 3 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Georg Schmidt
7 */
8
9// https://www.dokuwiki.org/devel:syntax_plugins
10class syntax_plugin_pgpinlinesupport extends DokuWiki_Syntax_Plugin
11{
12
13    // Kind of syntax
14    function getType()
15    {
16        return 'substition';
17    }
18
19    // Paragraph type
20    function getPType()
21    {
22        return 'block';
23    }
24
25    // sorting order
26    function getSort()
27    {
28        return 2;
29    }
30
31    // SHA3-Pattern
32    function connectTo($mode)
33    {
34        $this->Lexer->addSpecialPattern('-----BEGIN PGP MESSAGE-----[^-]+-----END PGP MESSAGE-----', $mode, 'plugin_pgpinlinesupport');
35    }
36
37    // Trim Match
38    function handle($match, $state, $pos, Doku_Handler $handler)
39    {
40        return $match;
41    }
42
43    // Render output
44    public function render($mode, Doku_Renderer $renderer, $data)
45    {
46
47        if ($mode == 'xhtml')
48        {
49            $renderer->doc .= '<pre>' . $data . '</pre>';
50            return true;
51        }
52        return false;
53    }
54}
55
56//Setup VIM: ex: et ts=4 enc=utf-8 :