` and * `...`. * * This renderer is used only by {@see GfmSpecTest} so the spec roundtrip * can compare against byte-level spec HTML. Production rendering is * unchanged. Methods not overridden here fall through to the XHTML * renderer (paragraphs, emphasis, code spans, lists, etc.) — those render * the same shape the spec expects. * * Note: title attributes on links/images are discarded at handle time * (no DW instruction slot), so spec examples that expect `title="..."` * still don't pass and stay in `skip.php`. */ class SpecCompatRenderer extends Doku_Renderer_xhtml { public function internalmedia( $src, $title = null, $align = null, $width = null, $height = null, $cache = null, $linking = null, $return = false ) { $this->doc .= $this->specImg($src, $title, $width, $height); } public function externalmedia( $src, $title = null, $align = null, $width = null, $height = null, $cache = null, $linking = null, $return = false ) { $this->doc .= $this->specImg($src, $title, $width, $height); } public function internallink($id, $name = null, $search = null, $returnonly = false, $linktype = 'content') { $this->doc .= $this->specLink($id, $name); } public function externallink($url, $name = null, $returnonly = false) { $this->doc .= $this->specLink($url, $name); } public function interwikilink($match, $name, $wikiName, $wikiUri, $returnonly = false) { // Spec has no interwiki expectations; emit the raw `wp>Page` form as // href so the mode is still visible but obviously non-standard. $this->doc .= $this->specLink($match, $name); } public function emaillink($address, $name = null, $returnonly = false) { $this->doc .= $this->specLink('mailto:' . $address, $name ?? $address); } public function locallink($hash, $name = null, $returnonly = false) { $this->doc .= $this->specLink('#' . $hash, $name ?? $hash); } public function windowssharelink($url, $name = null, $returnonly = false) { $this->doc .= $this->specLink($url, $name); } private function specImg($src, $alt, $width, $height): string { $out = 'label. If the label is a media * descriptor array (the shape Media::parseMedia() returns, passed by * Internallink / GfmLink when the label is `{{img}}` / `![alt](img)`), * render the inside the . */ private function specLink($href, $label): string { if (is_array($label) && isset($label['type'])) { $img = $this->specImg( $label['src'], $label['title'], $label['width'] ?? null, $label['height'] ?? null ); return '' . $img . ''; } $text = ($label === null || $label === '') ? $href : $label; return '' . hsc((string) $text) . ''; } }