|
13 | 13 |
|
14 | 14 | class syntax_plugin_struct_output extends DokuWiki_Syntax_Plugin |
15 | 15 | { |
16 | | - protected $hasBeenRendered = false; |
| 16 | + protected $hasBeenRendered = array('metadata'=>false, 'xhtml'=>false); |
17 | 17 |
|
18 | 18 | protected const XHTML_OPEN = '<div id="plugin__struct_output">'; |
19 | 19 | protected const XHTML_CLOSE = '</div>'; |
@@ -97,13 +97,25 @@ public function render($format, Doku_Renderer $renderer, $data) |
97 | 97 | return true; |
98 | 98 | } |
99 | 99 | } |
100 | | - if (!isset($INFO['id']) || ($ID != $INFO['id'])) return true; |
101 | | - if (!$INFO['exists']) return true; |
102 | | - if ($this->hasBeenRendered) return true; |
| 100 | + if (!isset($INFO) || $format == "metadata") { |
| 101 | + $pagename = pageinfo()['id']; |
| 102 | + } else { |
| 103 | + $pagename = $INFO['id']; |
| 104 | + } |
| 105 | + |
| 106 | + if ($ID != $pagename) return true; |
| 107 | + if (!page_exists($pagename)) return true; |
| 108 | + if ($this->hasBeenRendered['metadata'] && $format == 'metadata') return true; |
| 109 | + if ($this->hasBeenRendered['xhtml'] && $format == 'xhtml') return true; |
103 | 110 | if (!preg_match(self::WHITELIST_ACTIONS, act_clean($ACT))) return true; |
104 | 111 |
|
105 | 112 | // do not render the output twice on the same page, e.g. when another page has been included |
106 | | - $this->hasBeenRendered = true; |
| 113 | + if ($format == 'metadata') { |
| 114 | + $this->hasBeenRendered['metadata'] = true; |
| 115 | + } |
| 116 | + else if ($format == 'xhtml') { |
| 117 | + $this->hasBeenRendered['xhtml'] = true; |
| 118 | + } |
107 | 119 | try { |
108 | 120 | $assignments = Assignments::getInstance(); |
109 | 121 | } catch (StructException $e) { |
|
0 commit comments