diff --git a/phpdotnet/phd/Package/Generic/XHTML.php b/phpdotnet/phd/Package/Generic/XHTML.php
index 954d4438..38a2490a 100644
--- a/phpdotnet/phd/Package/Generic/XHTML.php
+++ b/phpdotnet/phd/Package/Generic/XHTML.php
@@ -1218,12 +1218,26 @@ public function format_emphasis($open, $name, $attrs)
public function format_fieldsynopsis($open, $name, $attrs) {
$this->cchunk["fieldsynopsis"] = $this->dchunk["fieldsynopsis"];
if ($open) {
+ if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) {
+ $this->pushRole($attrs[Reader::XMLNS_DOCBOOK]["role"]);
+ }
return '
';
}
+ if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) {
+ $this->popRole();
+ }
return ";
\n";
}
public function format_fieldsynopsis_modifier_text($value, $tag) {
+ if ($this->getRole() === "attribute") {
+ $attribute = trim(strtolower($value), "#[]\\");
+ $href = Format::getFilename("class.$attribute");
+ if ($href) {
+ return '' .$value. ' ';
+ }
+ return false;
+ }
$this->cchunk["fieldsynopsis"]["modifier"] = trim($value);
return $this->TEXT($value);
}
diff --git a/tests/package/generic/attribute_formatting_003.phpt b/tests/package/generic/attribute_formatting_003.phpt
new file mode 100644
index 00000000..a042c8a4
--- /dev/null
+++ b/tests/package/generic/attribute_formatting_003.phpt
@@ -0,0 +1,88 @@
+--TEST--
+Attribute formatting 003 - Class properties/constants
+--FILE--
+setXml_file($xml_file);
+
+$format = new TestGenericChunkedXHTML;
+
+$format->SQLiteIndex(
+ null, // $context,
+ null, // $index,
+ "class.knownattribute", // $id,
+ "file.knownattribute.is.in", // $filename,
+ "", // $parent,
+ "", // $sdesc,
+ "", // $ldesc,
+ "", // $element,
+ "", // $previous,
+ "", // $next,
+ 0, // $chunk
+);
+$format->SQLiteIndex(
+ null, // $context,
+ null, // $index,
+ "class.anotherknownattribute", // $id,
+ "file.anotherknownattribute.is.in", // $filename,
+ "", // $parent,
+ "", // $sdesc,
+ "", // $ldesc,
+ "", // $element,
+ "", // $previous,
+ "", // $next,
+ 0, // $chunk
+);
+
+$render = new TestRender(new Reader, $config, $format);
+
+$render->run();
+?>
+--EXPECT--
+Filename: attribute-formatting-003.html
+Content:
+
diff --git a/tests/package/generic/data/attribute_formatting_003.xml b/tests/package/generic/data/attribute_formatting_003.xml
new file mode 100644
index 00000000..3905c5c8
--- /dev/null
+++ b/tests/package/generic/data/attribute_formatting_003.xml
@@ -0,0 +1,38 @@
+
+
+ 1. Property/Constant with unknown attributes
+
+
+ ClassName
+
+ Properties/Constants
+
+ #[\UnknownAttribute]
+ #[\AnotherUnknownAttribute]
+ public
+ readonly
+ string
+ CONSTANT_NAME
+
+
+
+
+
+ 2. Property/Constant with known attributes
+
+
+ ClassName
+
+ Properties/Constants
+
+ #[\KnownAttribute]
+ #[\AnotherKnownAttribute]
+ public
+ readonly
+ string
+ propertyName
+
+
+
+
+