1<?php
2if (!defined('DOKU_INC')) die();
3
4class renderer_plugin_mermaid extends Doku_Renderer_xhtml
5{
6    function underline_open()
7    {
8        $xhtml = '<em class="u">';
9
10        $xhtml = htmlentities($xhtml, ENT_NOQUOTES);
11        $xhtml = str_replace(array('"'), array('\''), $xhtml);
12
13        $this->doc .= $xhtml;
14    }
15
16    function underline_close()
17    {
18        $xhtml = '</em>';
19
20        $xhtml = htmlentities($xhtml, ENT_NOQUOTES);
21        $xhtml = str_replace(array('"'), array('\''), $xhtml);
22
23        $this->doc .= $xhtml;
24    }
25
26    function internallink($id, $name = null, $search = null, $returnonly = false, $linktype = 'content')
27    {
28        $xhtml = parent::internallink($id, $name, $search, true, $linktype);
29
30        $xhtml = htmlentities($xhtml, ENT_NOQUOTES);
31        $xhtml = str_replace(array('"'), array('\''), $xhtml);
32
33        if($returnonly)
34        {
35            return $xhtml;
36        }
37        else
38        {
39            $this->doc .= $xhtml;
40        }
41    }
42
43    function externallink($url, $name = null, $returnonly = false)
44    {
45        $xhtml = parent::externallink($url, $name, true);
46
47        $xhtml = htmlentities($xhtml,ENT_NOQUOTES);
48        $xhtml = str_replace(array('"'), array('\''), $xhtml);
49
50        //output formatted
51        if($returnonly)
52        {
53            return $xhtml;
54        }
55        else
56        {
57            $this->doc .= $xhtml;
58        }
59    }
60
61    function internalmedia($src, $title = null, $align = null, $width = null, $height = null, $cache = null, $linking = null, $return = false)
62    {
63        $xhtml = parent::internalmedia($src, $title, $align, $width, $height, $cache, $linking, true);
64
65        $xhtml = htmlentities($xhtml,ENT_NOQUOTES);
66        $xhtml = str_replace(array('"'), array('\''), $xhtml);
67
68        //output formatted
69        if($return)
70        {
71            return $xhtml;
72        }
73        else
74        {
75            $this->doc .= $xhtml;
76        }
77    }
78
79    function cdata($text)
80    {
81        $this->doc .= $text;
82    }
83
84    public function p_open()
85    {
86    }
87
88    public function p_close()
89    {
90    }
91}