1<?php
2
3
4require_once(__DIR__ . '/../vendor/autoload.php');
5
6use ComboStrap\BreadcrumbTag;
7use ComboStrap\PluginUtility;
8use ComboStrap\XmlTagProcessing;
9
10
11/**
12 * The empty pattern / void element
13 * (inline)
14 */
15class syntax_plugin_combo_xmlinlineemptytag extends DokuWiki_Syntax_Plugin
16{
17
18    // should be the same than the last name of the class name
19    const TAG = "xmlemptytag";
20
21    function getType(): string
22    {
23        return 'substition';
24    }
25
26    /**
27     * How Dokuwiki will add P element
28     *
29     *  * 'normal' - Inline
30     *  * 'block' - Block (dokuwiki does not create p inside)
31     *  * 'stack' - Block (dokuwiki creates p inside)
32     *
33     * @see DokuWiki_Syntax_Plugin::getPType()
34     */
35    function getPType(): string
36    {
37        /**
38         * Empty tag may be also block (ie Navigational {@link BreadcrumbTag} for instance
39         */
40        return 'normal';
41    }
42
43    function getAllowedTypes(): array
44    {
45        return array();
46    }
47
48    function getSort(): int
49    {
50        // should be before all container tag
51        return 998;
52    }
53
54
55    function connectTo($mode)
56    {
57
58        $pattern = PluginUtility::getEmptyTagPatternGeneral();
59        $this->Lexer->addSpecialPattern($pattern, $mode, PluginUtility::getModeFromTag($this->getPluginComponent()));
60
61    }
62
63
64    function handle($match, $state, $pos, Doku_Handler $handler): array
65    {
66
67        return XmlTagProcessing::handleStaticEmptyTag($match, $state, $pos, $handler, $this);
68
69    }
70
71    /**
72     * Render the output
73     * @param string $format
74     * @param Doku_Renderer $renderer
75     * @param array $data - what the function handle() return'ed
76     * @return boolean - rendered correctly? (however, returned value is not used at the moment)
77     * @see DokuWiki_Syntax_Plugin::render()
78     */
79    function render($format, Doku_Renderer $renderer, $data): bool
80    {
81
82        return XmlTagProcessing::renderStaticEmptyTag($format, $renderer, $data, $this);
83
84    }
85
86
87}
88
89