[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-doc-cvs
Subject:    [DOC-CVS] [phd] phd-refentry-support-classes-and-vars: Support annotations for verifying version inf
From:       George Peter Banyard <noreply () php ! net>
Date:       2023-10-21 12:21:38
Message-ID: gZOiKtDSMl0aKJK1PRIxZDexrCkKVyODnKlUtCn9cE () main ! php ! net
[Download RAW message or body]

Author: George Peter Banyard (Girgias)
Date: 2023-10-21T13:07:56+01:00

Commit: https://github.com/php/phd/commit/c5576a276547f2d3195c33ffdbad4960076de50c
Raw diff: https://github.com/php/phd/commit/c5576a276547f2d3195c33ffdbad4960076de50c.diff


Support annotations for verifying version info

Changed paths:
  M  phpdotnet/phd/Index.php
  M  phpdotnet/phd/Package/PHP/XHTML.php


Diff:

diff --git a/phpdotnet/phd/Index.php b/phpdotnet/phd/Index.php
index 0dd08294..356bd1b0 100644
--- a/phpdotnet/phd/Index.php
+++ b/phpdotnet/phd/Index.php
@@ -345,8 +345,8 @@ public function format_container_chunk($open, $name, $attrs, \
$props) {  public function format_refentry($open, $name, $attrs, $props) {
         /* Note role attribute also has usage with "noversion" to not check version \
                availability */
         /* We overwrite the tag name to continue working with the usual indexing */
-        if (array_key_exists('role', $attrs)) {
-            return match ($attrs['role']) {
+        if (isset($attrs[Reader::XMLNS_DOCBOOK]['role'])) {
+            return match ($attrs[Reader::XMLNS_DOCBOOK]['role']) {
                 'class', 'enum' => $this->format_container_chunk($open, \
                'phpdoc:classref', $attrs, $props),
                 'exception' => $this->format_container_chunk($open, \
                'phpdoc:exceptionref', $attrs, $props),
                 'variable' => $this->format_chunk($open, 'phpdoc:varentry', $attrs, \
                $props),
diff --git a/phpdotnet/phd/Package/PHP/XHTML.php \
b/phpdotnet/phd/Package/PHP/XHTML.php index 0208fa37..61edf0de 100644
--- a/phpdotnet/phd/Package/PHP/XHTML.php
+++ b/phpdotnet/phd/Package/PHP/XHTML.php
@@ -888,15 +888,17 @@ public function format_exception_chunk($open, $name, $attrs, \
$props) {  public function format_refentry($open, $name, $attrs, $props) {
         /* Note role attribute also has usage with "noversion" to not check version \
availability */  /* TODO This should be migrated to the annotations attribute */
-        if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) {
+        if (isset($attrs[Reader::XMLNS_DOCBOOK]["annotations"])) {
+            $this->cchunk["verinfo"] = \
!str_contains($attrs[Reader::XMLNS_DOCBOOK]["annotations"], 'verify_info:false'); +   \
                } else if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) {
             $this->cchunk["verinfo"] = !($attrs[Reader::XMLNS_DOCBOOK]["role"] == \
"noversion");  } else {
             $this->cchunk["verinfo"] = true;
         }
 
         /* We overwrite the tag name to continue working with the usual indexing */
-        if (array_key_exists('role', $attrs)) {
-            return match ($attrs['role']) {
+        if (isset($attrs[Reader::XMLNS_DOCBOOK]['role'])) {
+            return match ($attrs[Reader::XMLNS_DOCBOOK]['role']) {
                 'class', 'enum', 'exception' => $this->format_class_chunk($open, \
                'reference', $attrs, $props),
                 'variable' => $this->format_chunk($open, 'refentry', $attrs, \
                $props),
                 default => $this->format_chunk($open, $name, $attrs, $props),
@@ -908,11 +910,8 @@ public function format_refentry($open, $name, $attrs, $props) {
     public function format_class_chunk($open, $name, $attrs, $props) {
         if ($open) {
             $retval = $this->format_container_chunk($open, "reference", $attrs, \
                $props);
-            if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) {
-                $this->cchunk["verinfo"] = !($attrs[Reader::XMLNS_DOCBOOK]["role"] \
                == "noversion");
-            } else {
-                $this->cchunk["verinfo"] = true;
-            }
+            /* Classes must have version availability information */
+            $this->cchunk["verinfo"] = true;
             return $retval;
         }
         return $this->format_container_chunk($open, "reference", $attrs, $props);

-- 
PHP Documentation Commits Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic