From 73a2a9e2a7d74e8793683285aa13b55167802e8b Mon Sep 17 00:00:00 2001 From: haszi Date: Thu, 22 Feb 2024 22:45:53 +0100 Subject: [PATCH 1/3] Enable nested roles Refactor role to be and array instead of a string to allow nesting of roles. Use the indent method to format constant list tables. Add tests for regular, table formatted and nested role containing variablelists. --- phpdotnet/phd/Format/Abstract/XHTML.php | 8 +- phpdotnet/phd/Package/Generic/XHTML.php | 59 +++++++------- phpdotnet/phd/Package/PEAR/XHTML.php | 22 +++--- phpdotnet/phd/Package/PHP/XHTML.php | 2 +- tests/php/data/variablelist_rendering_001.xml | 40 ++++++++++ tests/php/variablelist_rendering_001.phpt | 79 +++++++++++++++++++ 6 files changed, 167 insertions(+), 43 deletions(-) create mode 100644 tests/php/data/variablelist_rendering_001.xml create mode 100644 tests/php/variablelist_rendering_001.phpt diff --git a/phpdotnet/phd/Format/Abstract/XHTML.php b/phpdotnet/phd/Format/Abstract/XHTML.php index 07938cba..f1089a54 100644 --- a/phpdotnet/phd/Format/Abstract/XHTML.php +++ b/phpdotnet/phd/Format/Abstract/XHTML.php @@ -2,7 +2,7 @@ namespace phpdotnet\phd; abstract class Format_Abstract_XHTML extends Format { - public $role = false; + public $role = []; /* XHTMLPhDFormat */ protected $openPara = 0; @@ -39,14 +39,14 @@ public function UNDEF($open, $name, $attrs, $props) { } public function CDATA($str) { - switch($this->role) { + switch(end($this->role)) { case '': return '
'
                 . htmlspecialchars($str, ENT_QUOTES, "UTF-8")
                 . '
'; default: - return '
' - . $this->highlight(trim($str), $this->role, 'xhtml') + return '
' + . $this->highlight(trim($str), end($this->role), 'xhtml') . '
'; } } diff --git a/phpdotnet/phd/Package/Generic/XHTML.php b/phpdotnet/phd/Package/Generic/XHTML.php index 3c5ee6a1..6b189368 100644 --- a/phpdotnet/phd/Package/Generic/XHTML.php +++ b/phpdotnet/phd/Package/Generic/XHTML.php @@ -705,10 +705,10 @@ public function format_option($open, $name, $attrs) { if(!isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { $attrs[Reader::XMLNS_DOCBOOK]["role"] = "unknown"; } - $this->role = $role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; + $this->role[] = $role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; return ''; } - $this->role = null; + array_pop($this->role); return ""; } @@ -716,18 +716,18 @@ public function format_literal($open, $name, $attrs) { if ($open) { if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { - $this->role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; + $this->role[] = $attrs[Reader::XMLNS_DOCBOOK]["role"]; } else { - $this->role = false; + $this->role[] = null; } return ''; } - $this->role = false; + array_pop($this->role); return ''; } public function format_literal_text($value, $tag) { - switch ($this->role) { + switch (end($this->role)) { case 'infdec': $value = (float)$value; $p = strpos($value, '.'); @@ -930,7 +930,7 @@ public function format_refsect($open, $name, $attrs) { if(!isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { $attrs[Reader::XMLNS_DOCBOOK]["role"] = "unknown-" . ++$role; } - $this->role = $role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; + $this->role[] = $role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; if (isset($attrs[Reader::XMLNS_XML]["id"])) { $id = $attrs[Reader::XMLNS_XML]["id"]; @@ -941,7 +941,7 @@ public function format_refsect($open, $name, $attrs) { return '
'; } - $this->role = null; + array_pop($this->role); return "
\n"; } @@ -1495,24 +1495,29 @@ public function format_step($open, $name, $attrs) { public function format_variablelist($open, $name, $attrs, $props) { if ($open) { if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { - $this->role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; + $this->role[] = $attrs[Reader::XMLNS_DOCBOOK]["role"]; } $classStr = $headerStr = $idStr = ''; if (isset($attrs[Reader::XMLNS_XML]["id"])) { $idStr = ' id="' . $attrs[Reader::XMLNS_XML]["id"] . '"'; } - if ($this->role === 'constant_list') { + if (end($this->role) === 'constant_list') { $tagName = 'table'; $classStr = ' class="doctable table"'; - $headerStr = "\n\n" . $this->autogen('Constants', $props['lang']) . "\n" . $this->autogen('Description', $props['lang']) . "\n"; + $headerStr = "\n" . $this->indent($props["depth"] + 1) . "\n" + . $this->indent($props["depth"] + 2) . "" + . $this->autogen('Constants', $props['lang']) . "\n" + . $this->indent($props["depth"] + 2) . "" + . $this->autogen('Description', $props['lang']) . "\n" + . $this->indent($props["depth"] + 1) . ""; } else { $tagName = 'dl'; } return '<' . $tagName . $idStr . $classStr . '>' . $headerStr; } - $tagName = ($this->role === 'constant_list') ? 'table' : 'dl'; - $this->role = false; - return "\n"; + $tagName = (end($this->role) === 'constant_list') ? 'table' : 'dl'; + array_pop($this->role); + return ""; } public function format_varlistentry($open, $name, $attrs) { if ($open) { @@ -1521,29 +1526,29 @@ public function format_varlistentry($open, $name, $attrs) { } else { unset($this->cchunk['varlistentry']['id']); } - return ($this->role === 'constant_list') ? '' : ''; + return (end($this->role) === 'constant_list') ? '' : ''; } - return ($this->role === 'constant_list') ? '' : ''; + return (end($this->role) === 'constant_list') ? '' : ''; } public function format_varlistentry_term($open, $name, $attrs, $props) { - $tagName = ($this->role === 'constant_list') ? 'td' : 'dt'; + $tagName = (end($this->role) === 'constant_list') ? 'td' : 'dt'; if ($open) { if (isset($this->cchunk['varlistentry']['id'])) { $id = $this->cchunk['varlistentry']['id']; unset($this->cchunk['varlistentry']['id']); return '<' . $tagName . ' id="' . $id . '">'; } else { - return "<" . $tagName . ">\n"; + return "<" . $tagName . ">"; } } - return "\n"; + return ""; } public function format_varlistentry_listitem($open, $name, $attrs) { - $tagName = ($this->role === 'constant_list') ? 'td' : 'dd'; + $tagName = (end($this->role) === 'constant_list') ? 'td' : 'dd'; if ($open) { - return "<" . $tagName . ">\n"; + return "<" . $tagName . ">"; } - return "\n"; + return ""; } public function format_term($open, $name, $attrs, $props) { if ($open) { @@ -1587,14 +1592,14 @@ public function format_example_content($open, $name, $attrs) { public function format_programlisting($open, $name, $attrs) { if ($open) { if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { - $this->role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; + $this->role[] = $attrs[Reader::XMLNS_DOCBOOK]["role"]; } else { - $this->role = false; + $this->role[] = null; } return '
'; } - $this->role = false; + array_pop($this->role); return "
\n"; } public function format_programlisting_text($value, $tag) { @@ -1685,9 +1690,9 @@ public function format_table_title($open, $name, $attrs, $props) } public function format_variablelist_title($open, $name, $attrs, $props) { if ($open) { - return ($this->role === 'constant_list') ? "" : ""; + return (end($this->role) === 'constant_list') ? "" : ""; } - return ($this->role === 'constant_list') ? "" : ""; + return (end($this->role) === 'constant_list') ? "" : ""; } public function format_mediaobject($open, $name, $attrs) { diff --git a/phpdotnet/phd/Package/PEAR/XHTML.php b/phpdotnet/phd/Package/PEAR/XHTML.php index 5fd02475..0616fa93 100755 --- a/phpdotnet/phd/Package/PEAR/XHTML.php +++ b/phpdotnet/phd/Package/PEAR/XHTML.php @@ -684,15 +684,15 @@ public function format_programlisting($open, $name, $attrs) if ($open) { $this->trim = true; if (isset($attrs[Reader::XMLNS_DOCBOOK]['role'])) { - $this->role = $attrs[Reader::XMLNS_DOCBOOK]['role']; + $this->role[] = $attrs[Reader::XMLNS_DOCBOOK]['role']; } else { - $this->role = ''; + $this->role[] = ''; } - return '
role) ? end($this->role) . 'code' : 'programlisting') . '">'; } - $this->role = false; + array_pop($this->role); $this->trim = false; return '
'; @@ -710,7 +710,7 @@ public function format_programlisting($open, $name, $attrs) */ public function format_programlisting_text($value, $tag) { - switch($this->role) { + switch(end($this->role)) { case 'php': if (strrpos($value, '')) { return $this->highlight(trim($value), 'php', 'xhtml'); @@ -719,7 +719,7 @@ public function format_programlisting_text($value, $tag) } break; default: - return $this->highlight(trim($value), $this->role, 'xhtml'); + return $this->highlight(trim($value), end($this->role), 'xhtml'); } } @@ -760,26 +760,26 @@ public function CDATA($str) if ($this->trim) { $str = rtrim($str); } - if (!$this->role) { + if (!end($this->role)) { return str_replace( array("\n", ' '), array('
', ' '), htmlspecialchars($str, ENT_QUOTES, 'UTF-8') ); } - switch ($this->role) { + switch (end($this->role)) { case 'php': if (strrpos($str, '')) { - $str = $this->highlight(trim($str), $this->role, 'xhtml'); + $str = $this->highlight(trim($str), end($this->role), 'xhtml'); } else { - $str = $this->highlight("", $this->role, 'xhtml'); + $str = $this->highlight("", end($this->role), 'xhtml'); } break; case '': $str = htmlspecialchars($str, ENT_QUOTES, 'UTF-8'); break; default: - $str = $this->highlight($str, $this->role, 'xhtml'); + $str = $this->highlight($str, end($this->role), 'xhtml'); break; } diff --git a/phpdotnet/phd/Package/PHP/XHTML.php b/phpdotnet/phd/Package/PHP/XHTML.php index 4b2928f0..5d3c7257 100644 --- a/phpdotnet/phd/Package/PHP/XHTML.php +++ b/phpdotnet/phd/Package/PHP/XHTML.php @@ -843,7 +843,7 @@ public function format_function_text($value, $tag, $display_value = null) { if ($filename !== null) { if ($this->CURRENT_ID !== $filename) { $rel = $desc = ""; - if ($this->role == "seealso") { + if (end($this->role) == "seealso") { $rel = ' rel="rdfs-seeAlso"'; $desc = " - " . Format::getLongDescription($filename); } diff --git a/tests/php/data/variablelist_rendering_001.xml b/tests/php/data/variablelist_rendering_001.xml new file mode 100644 index 00000000..04580261 --- /dev/null +++ b/tests/php/data/variablelist_rendering_001.xml @@ -0,0 +1,40 @@ + + + +
+ 1. Variablelist with no role + + + VARIABLELIST_TEST_CONSTANT + + + Description of constant + + + + +
+ +
+ 2. Variablelist with role="constant_list" + + + VARIABLELIST_TEST_CONSTANT_IN_CONSTANT_LIST + + + literal will add its own "role" + + + + + VARIABLELIST_TEST_CONSTANT_IN_CONSTANT_LIST2 + + + Role should have not been overwritten by literal + + + + +
+ +
\ No newline at end of file diff --git a/tests/php/variablelist_rendering_001.phpt b/tests/php/variablelist_rendering_001.phpt new file mode 100644 index 00000000..5855f264 --- /dev/null +++ b/tests/php/variablelist_rendering_001.phpt @@ -0,0 +1,79 @@ +--TEST-- +Variablelist rendering 001 +--FILE-- + true, + "xml_root" => dirname($xml_file), + "xml_file" => $xml_file, + "output_dir" => __DIR__ . "/output/", +); + +$extra = array( + "lang_dir" => __PHDDIR__ . "phpdotnet/phd/data/langs/", + "phpweb_version_filename" => dirname($xml_file) . '/version.xml', + "phpweb_acronym_filename" => dirname($xml_file) . '/acronyms.xml', +); + +$render = new TestRender($formatclass, $opts, $extra); + +if (Index::requireIndexing() && !file_exists($opts["output_dir"])) { + mkdir($opts["output_dir"], 0755); +} + +$render->run(); +?> +--EXPECTF-- +Filename: variablelist-rendering.html +Content: +
+ +
+

%d. Variablelist with no role

+
+ +
VARIABLELIST_TEST_CONSTANT
+
+ + Description of constant + +
+ +
+
+ +
+

%d. Variablelist with role="constant_list"

+ + + + + + + + + + + + + +
ConstantsDescription
VARIABLELIST_TEST_CONSTANT_IN_CONSTANT_LIST + + literal will add its own "role" + +
VARIABLELIST_TEST_CONSTANT_IN_CONSTANT_LIST2 + + Role should have not been overwritten by literal + +
+
+ +
From b108db8bf1967d3b47a5f61e457fdea84693e127 Mon Sep 17 00:00:00 2001 From: haszi Date: Thu, 22 Feb 2024 22:53:52 +0100 Subject: [PATCH 2/3] Add EOL to EOF of test input file --- tests/php/data/variablelist_rendering_001.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/php/data/variablelist_rendering_001.xml b/tests/php/data/variablelist_rendering_001.xml index 04580261..501daca1 100644 --- a/tests/php/data/variablelist_rendering_001.xml +++ b/tests/php/data/variablelist_rendering_001.xml @@ -37,4 +37,4 @@ - \ No newline at end of file + From 1f1d272d4b584dddb2a9e5c94337a5bea14d27c8 Mon Sep 17 00:00:00 2001 From: haszi Date: Fri, 23 Feb 2024 20:23:07 +0100 Subject: [PATCH 3/3] Address review comments Add methods to push, pop and get role, and use these for all role accesses. Make underlying $role array private. Add comment on $role array being a LIFO stack. --- phpdotnet/phd/Format/Abstract/XHTML.php | 21 +++++++--- phpdotnet/phd/Package/Generic/XHTML.php | 53 ++++++++++--------------- phpdotnet/phd/Package/PEAR/XHTML.php | 24 +++++------ phpdotnet/phd/Package/PHP/XHTML.php | 2 +- 4 files changed, 49 insertions(+), 51 deletions(-) diff --git a/phpdotnet/phd/Format/Abstract/XHTML.php b/phpdotnet/phd/Format/Abstract/XHTML.php index f1089a54..c2ddd71d 100644 --- a/phpdotnet/phd/Format/Abstract/XHTML.php +++ b/phpdotnet/phd/Format/Abstract/XHTML.php @@ -2,7 +2,9 @@ namespace phpdotnet\phd; abstract class Format_Abstract_XHTML extends Format { - public $role = []; + + /** @var array Last In First Out stack of roles */ + private array $role = []; /* XHTMLPhDFormat */ protected $openPara = 0; @@ -39,14 +41,14 @@ public function UNDEF($open, $name, $attrs, $props) { } public function CDATA($str) { - switch(end($this->role)) { + switch($this->getRole()) { case '': return '
'
                 . htmlspecialchars($str, ENT_QUOTES, "UTF-8")
                 . '
'; default: - return '
' - . $this->highlight(trim($str), end($this->role), 'xhtml') + return '
' + . $this->highlight(trim($str), $this->getRole(), 'xhtml') . '
'; } } @@ -123,6 +125,15 @@ public function restorePara() { } } -} + protected function pushRole(?string $role): void { + $this->role[] = $role; + } + protected function getRole(): ?string { + return end($this->role); + } + protected function popRole(): ?string { + return array_pop($this->role); + } +} diff --git a/phpdotnet/phd/Package/Generic/XHTML.php b/phpdotnet/phd/Package/Generic/XHTML.php index 6b189368..189bb837 100644 --- a/phpdotnet/phd/Package/Generic/XHTML.php +++ b/phpdotnet/phd/Package/Generic/XHTML.php @@ -705,29 +705,25 @@ public function format_option($open, $name, $attrs) { if(!isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { $attrs[Reader::XMLNS_DOCBOOK]["role"] = "unknown"; } - $this->role[] = $role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; - return ''; + $this->pushRole($attrs[Reader::XMLNS_DOCBOOK]["role"]); + return ''; } - array_pop($this->role); + $this->popRole(); return ""; } public function format_literal($open, $name, $attrs) { if ($open) { - if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { - $this->role[] = $attrs[Reader::XMLNS_DOCBOOK]["role"]; - } else { - $this->role[] = null; - } + $this->pushRole($attrs[Reader::XMLNS_DOCBOOK]["role"] ?? null); return ''; } - array_pop($this->role); + $this->popRole(); return ''; } public function format_literal_text($value, $tag) { - switch (end($this->role)) { + switch ($this->getRole()) { case 'infdec': $value = (float)$value; $p = strpos($value, '.'); @@ -930,18 +926,18 @@ public function format_refsect($open, $name, $attrs) { if(!isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { $attrs[Reader::XMLNS_DOCBOOK]["role"] = "unknown-" . ++$role; } - $this->role[] = $role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; + $this->pushRole($attrs[Reader::XMLNS_DOCBOOK]["role"]); if (isset($attrs[Reader::XMLNS_XML]["id"])) { $id = $attrs[Reader::XMLNS_XML]["id"]; } else { - $id = $name. "-" . $this->CURRENT_CHUNK . "-" . $role; + $id = $name. "-" . $this->CURRENT_CHUNK . "-" . $this->getRole(); } - return '
'; + return '
'; } - array_pop($this->role); + $this->popRole(); return "
\n"; } @@ -1495,13 +1491,13 @@ public function format_step($open, $name, $attrs) { public function format_variablelist($open, $name, $attrs, $props) { if ($open) { if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { - $this->role[] = $attrs[Reader::XMLNS_DOCBOOK]["role"]; + $this->pushRole($attrs[Reader::XMLNS_DOCBOOK]["role"]); } $classStr = $headerStr = $idStr = ''; if (isset($attrs[Reader::XMLNS_XML]["id"])) { $idStr = ' id="' . $attrs[Reader::XMLNS_XML]["id"] . '"'; } - if (end($this->role) === 'constant_list') { + if ($this->getRole() === 'constant_list') { $tagName = 'table'; $classStr = ' class="doctable table"'; $headerStr = "\n" . $this->indent($props["depth"] + 1) . "\n" @@ -1515,8 +1511,8 @@ public function format_variablelist($open, $name, $attrs, $props) { } return '<' . $tagName . $idStr . $classStr . '>' . $headerStr; } - $tagName = (end($this->role) === 'constant_list') ? 'table' : 'dl'; - array_pop($this->role); + $tagName = ($this->getRole() === 'constant_list') ? 'table' : 'dl'; + $this->popRole(); return ""; } public function format_varlistentry($open, $name, $attrs) { @@ -1526,12 +1522,12 @@ public function format_varlistentry($open, $name, $attrs) { } else { unset($this->cchunk['varlistentry']['id']); } - return (end($this->role) === 'constant_list') ? '' : ''; + return ($this->getRole() === 'constant_list') ? '' : ''; } - return (end($this->role) === 'constant_list') ? '' : ''; + return ($this->getRole() === 'constant_list') ? '' : ''; } public function format_varlistentry_term($open, $name, $attrs, $props) { - $tagName = (end($this->role) === 'constant_list') ? 'td' : 'dt'; + $tagName = ($this->getRole() === 'constant_list') ? 'td' : 'dt'; if ($open) { if (isset($this->cchunk['varlistentry']['id'])) { $id = $this->cchunk['varlistentry']['id']; @@ -1544,7 +1540,7 @@ public function format_varlistentry_term($open, $name, $attrs, $props) { return ""; } public function format_varlistentry_listitem($open, $name, $attrs) { - $tagName = (end($this->role) === 'constant_list') ? 'td' : 'dd'; + $tagName = ($this->getRole() === 'constant_list') ? 'td' : 'dd'; if ($open) { return "<" . $tagName . ">"; } @@ -1591,15 +1587,10 @@ public function format_example_content($open, $name, $attrs) { } public function format_programlisting($open, $name, $attrs) { if ($open) { - if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { - $this->role[] = $attrs[Reader::XMLNS_DOCBOOK]["role"]; - } else { - $this->role[] = null; - } - + $this->pushRole($attrs[Reader::XMLNS_DOCBOOK]["role"] ?? null); return '
'; } - array_pop($this->role); + $this->popRole(); return "
\n"; } public function format_programlisting_text($value, $tag) { @@ -1690,9 +1681,9 @@ public function format_table_title($open, $name, $attrs, $props) } public function format_variablelist_title($open, $name, $attrs, $props) { if ($open) { - return (end($this->role) === 'constant_list') ? "" : ""; + return ($this->getRole() === 'constant_list') ? "" : ""; } - return (end($this->role) === 'constant_list') ? "" : ""; + return ($this->getRole() === 'constant_list') ? "" : ""; } public function format_mediaobject($open, $name, $attrs) { diff --git a/phpdotnet/phd/Package/PEAR/XHTML.php b/phpdotnet/phd/Package/PEAR/XHTML.php index 0616fa93..fdfef226 100755 --- a/phpdotnet/phd/Package/PEAR/XHTML.php +++ b/phpdotnet/phd/Package/PEAR/XHTML.php @@ -683,16 +683,12 @@ public function format_programlisting($open, $name, $attrs) { if ($open) { $this->trim = true; - if (isset($attrs[Reader::XMLNS_DOCBOOK]['role'])) { - $this->role[] = $attrs[Reader::XMLNS_DOCBOOK]['role']; - } else { - $this->role[] = ''; - } + $this->pushRole($attrs[Reader::XMLNS_DOCBOOK]['role'] ?? ''); - return '
getRole() ? $this->getRole() . 'code' : 'programlisting') . '">'; } - array_pop($this->role); + $this->popRole(); $this->trim = false; return '
'; @@ -710,7 +706,7 @@ public function format_programlisting($open, $name, $attrs) */ public function format_programlisting_text($value, $tag) { - switch(end($this->role)) { + switch($this->getRole()) { case 'php': if (strrpos($value, '')) { return $this->highlight(trim($value), 'php', 'xhtml'); @@ -719,7 +715,7 @@ public function format_programlisting_text($value, $tag) } break; default: - return $this->highlight(trim($value), end($this->role), 'xhtml'); + return $this->highlight(trim($value), $this->getRole(), 'xhtml'); } } @@ -760,26 +756,26 @@ public function CDATA($str) if ($this->trim) { $str = rtrim($str); } - if (!end($this->role)) { + if (!$this->getRole()) { return str_replace( array("\n", ' '), array('
', ' '), htmlspecialchars($str, ENT_QUOTES, 'UTF-8') ); } - switch (end($this->role)) { + switch ($this->getRole()) { case 'php': if (strrpos($str, '')) { - $str = $this->highlight(trim($str), end($this->role), 'xhtml'); + $str = $this->highlight(trim($str), $this->getRole(), 'xhtml'); } else { - $str = $this->highlight("", end($this->role), 'xhtml'); + $str = $this->highlight("", $this->getRole(), 'xhtml'); } break; case '': $str = htmlspecialchars($str, ENT_QUOTES, 'UTF-8'); break; default: - $str = $this->highlight($str, end($this->role), 'xhtml'); + $str = $this->highlight($str, $this->getRole(), 'xhtml'); break; } diff --git a/phpdotnet/phd/Package/PHP/XHTML.php b/phpdotnet/phd/Package/PHP/XHTML.php index 5d3c7257..6e4ba5a4 100644 --- a/phpdotnet/phd/Package/PHP/XHTML.php +++ b/phpdotnet/phd/Package/PHP/XHTML.php @@ -843,7 +843,7 @@ public function format_function_text($value, $tag, $display_value = null) { if ($filename !== null) { if ($this->CURRENT_ID !== $filename) { $rel = $desc = ""; - if (end($this->role) == "seealso") { + if ($this->getRole() === "seealso") { $rel = ' rel="rdfs-seeAlso"'; $desc = " - " . Format::getLongDescription($filename); }