diff --git a/phpdotnet/phd/Package/Generic/XHTML.php b/phpdotnet/phd/Package/Generic/XHTML.php index 284858bc..dc789933 100644 --- a/phpdotnet/phd/Package/Generic/XHTML.php +++ b/phpdotnet/phd/Package/Generic/XHTML.php @@ -1611,19 +1611,17 @@ public function format_constant($open, $name, $attrs) return ""; } public function format_constant_text($value, $tag) { + $tempLinkValue = str_replace( + array("\\", "_"), + array("-", "-"), + strtolower(trim($value, "_")) + ); if (str_contains($value, '::')) { // class constant - list($extensionAndClass, $constant) = explode( - "::", - str_replace( - array("\\", "_"), - array("-", "-"), - strtolower($value) - ) - ); + list($extensionAndClass, $constant) = explode("::", $tempLinkValue); $normalizedLinkFormat = $extensionAndClass . ".constants." . trim($constant, "-"); } else { - $normalizedLinkFormat = 'constant.' . str_replace('_', '-', strtolower(trim($value, "_"))); + $normalizedLinkFormat = 'constant.' . $tempLinkValue; } $link = $this->createLink($normalizedLinkFormat); diff --git a/tests/package/php/constant_links_001.phpt b/tests/package/php/constant_links_001.phpt index 93380ad2..6e565248 100644 --- a/tests/package/php/constant_links_001.phpt +++ b/tests/package/php/constant_links_001.phpt @@ -12,7 +12,7 @@ Config::init(["xml_file" => $xml_file]); $indices = [ [ - "docbook_id" => "constant.definitely-exists", + "docbook_id" => "constant.extension-namespace-definitely-exists", "filename" => "extensionname.constantspage", ], [ @@ -58,7 +58,7 @@ Content:

%d. Existing constants

- DEFINITELY_EXISTS + Extension\Namespace\DEFINITELY_EXISTS

Vendor\Namespace::DEFINITELY_EXISTS2

diff --git a/tests/package/php/data/constant_links.xml b/tests/package/php/data/constant_links.xml index e5c9c643..eb13986b 100644 --- a/tests/package/php/data/constant_links.xml +++ b/tests/package/php/data/constant_links.xml @@ -3,7 +3,7 @@
1. Existing constants - DEFINITELY_EXISTS + Extension\Namespace\DEFINITELY_EXISTS Vendor\Namespace::DEFINITELY_EXISTS2