diff --git a/phpdotnet/phd/Package/Generic/XHTML.php b/phpdotnet/phd/Package/Generic/XHTML.php
index 9040e21b..cc5ff88d 100644
--- a/phpdotnet/phd/Package/Generic/XHTML.php
+++ b/phpdotnet/phd/Package/Generic/XHTML.php
@@ -462,6 +462,9 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
/* DEFAULT */ false,
'footnote' => 'format_footnote_para_text',
),
+ 'property' => [
+ /* DEFAULT */ 'format_property_text',
+ ],
/* FIXME: This is one crazy stupid workaround for footnotes */
'constant' => array(
/* DEFAULT */ 'format_constant_text',
@@ -1843,6 +1846,30 @@ public function format_replaceable($open, $name, $attrs, $props) {
}
return false;
}
+
+ public function format_property_text($value, $tag) {
+ if (! str_contains($value, '::')) {
+ return $value;
+ }
+
+ $tempLinkValue = str_replace(
+ ["\\", "_", "$"],
+ ["-", "-", ""],
+ strtolower(trim($value, "_"))
+ );
+
+ list($extensionAndClass, $property) = explode("::", $tempLinkValue);
+ $normalizedLinkFormat = $extensionAndClass . ".props." . trim($property, "-");
+
+ $link = $this->createLink($normalizedLinkFormat);
+
+ if ($link === null || $link === "") {
+ return $value;
+ }
+
+ return '' . $value . '';
+ }
+
public function admonition_title($title, $lang)
{
return '' .($this->autogen($title, $lang)). '';
diff --git a/tests/package/php/data/property_linking.xml b/tests/package/php/data/property_linking.xml
new file mode 100644
index 00000000..c6daa9e4
--- /dev/null
+++ b/tests/package/php/data/property_linking.xml
@@ -0,0 +1,34 @@
+
+
%d. Existing property
+ + +%d. Nonexistent properties
++ Vendor\Namespace::$this_does_not_exist +
++ Vendor\Namespace::$thisDoesNotExist2 +
+%d. Properties with leading and trailing underscores in ID
+ + +