1<?php
2
3
4
5require_once(__DIR__ . '/../ComboStrap/PluginUtility.php');
6
7/**
8 * A rendering in XML
9 */
10class  renderer_plugin_combo_xml extends Doku_Renderer_xhtml
11{
12
13    const FORMAT = "xml";
14
15    /**
16     * The last two words of the class
17     */
18    const MODE = 'combo_'.self::FORMAT;
19
20
21    function getFormat(): string
22    {
23        return self::FORMAT;
24    }
25
26    /*
27     * Function that enable to list the plugin in the options for config:renderer_xhtml
28     * http://www.dokuwiki.org/config:renderer_xhtml
29     * setting in its Configuration Manager.
30     */
31    public function canRender($format)
32    {
33        return ($format == 'xml');
34    }
35
36
37    /**
38     * Render a heading
39     *
40     *
41     * @param string $text the text to display
42     * @param int $level header level
43     * @param int $pos byte position in the original source
44     */
45    function header($text, $level, $pos)
46    {
47
48        $this->doc .= "<h$level>$text</h$level>";
49
50    }
51
52    /**
53     * This are edit zone section (not HTML/Outline Section)
54     * @param int $level
55     */
56    public function section_open($level)
57    {
58        $this->doc .= "";
59    }
60
61    public function section_close()
62    {
63        $this->doc .= "";
64    }
65
66
67    public function document_start()
68    {
69        $this->doc .= '<?xml version="1.0" encoding="UTF-8" standalone="no" ?>';
70        $this->doc .= "<document>";
71    }
72
73    public function multiplyentity($x, $y): string
74    {
75        return "$x x $y";
76    }
77
78
79    function document_end()
80    {
81
82        $this->doc .= "</document>";
83
84        /**
85         * The result can be seen with
86         * doku.php?id=somepage&do=export_combo_xml
87         *
88         * Set the header temporarily for the export.php file
89         *
90         * The mode in the export is
91         */
92        $mode = "combo_" . $this->getPluginComponent();
93        global $ID;
94        p_set_metadata(
95            $ID,
96            array("format" => array($mode => array("Content-Type" => 'application/xml'))),
97            false,
98            true // Persistence is needed because there is a cache
99        );
100
101    }
102
103
104    /**
105     * https://getbootstrap.com/docs/4.4/content/typography/#inline-text-elements
106     */
107    public
108    function monospace_open()
109    {
110        $this->doc .= '<mark>';
111    }
112
113    public
114    function monospace_close()
115    {
116        $this->doc .= '</mark>';
117    }
118
119
120}
121