diff --git a/phpdotnet/phd/Package/Generic/XHTML.php b/phpdotnet/phd/Package/Generic/XHTML.php
index 40a26e75..20581b43 100644
--- a/phpdotnet/phd/Package/Generic/XHTML.php
+++ b/phpdotnet/phd/Package/Generic/XHTML.php
@@ -143,7 +143,7 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
'methodparam' => 'format_methodparam',
'methodsynopsis' => 'format_methodsynopsis',
'methodname' => 'format_methodname',
- 'member' => 'li',
+ 'member' => 'format_member',
'modifier' => 'span',
'note' => 'format_note',
'orgname' => 'span',
@@ -269,7 +269,7 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
'setindex' => 'format_chunk',
'shortaffil' => 'format_suppressed_tags',
'sidebar' => 'format_note',
- 'simplelist' => 'format_itemizedlist', /* FIXME: simplelists has few attributes that need to be implemented */
+ 'simplelist' => 'format_simplelist',
'simplesect' => 'div',
'simpara' => array(
/* DEFAULT */ 'p',
@@ -446,6 +446,7 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
'literal' => 'format_literal_text',
'email' => 'format_email_text',
'titleabbrev' => 'format_suppressed_text',
+ 'member' => 'format_member_text',
);
/** @var array */
@@ -501,6 +502,11 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
"varlistentry" => array(
"listitems" => array(),
),
+ "simplelist" => array(
+ "members" => array(),
+ "type" => null,
+ "columns" => null,
+ ),
);
protected $pihandlers = array(
@@ -2040,6 +2046,126 @@ public function format_itemizedlist($open, $name, $attrs, $props) {
return '';
}
+ public function format_simplelist($open, $name, $attrs, $props) {
+ if ($open) {
+ $this->cchunk["simplelist"]["type"] = $attrs[Reader::XMLNS_DOCBOOK]["type"] ?? "";
+ $this->cchunk["simplelist"]["columns"] = $attrs[Reader::XMLNS_DOCBOOK]["columns"] ?? 1;
+
+ if ($this->cchunk["simplelist"]["columns"] < 1) {
+ $this->cchunk["simplelist"]["columns"] = 1;
+ }
+
+ if ($this->cchunk["simplelist"]["type"] === "inline") {
+ return '';
+ }
+
+ if ($this->cchunk["simplelist"]["type"] === "vert"
+ || $this->cchunk["simplelist"]["type"] === "horiz") {
+ return '' . "\n" . $this->indent($props["depth"] + 1) . "\n";
+ }
+
+ return '
",
+ "vert" => $this->simplelist_format_vertical($props["depth"])
+ . $this->indent($props["depth"] + 1) . "\n"
+ . $this->indent($props["depth"]) . "",
+ default => "",
+ };
+
+ $this->cchunk["simplelist"] = $this->dchunk["simplelist"];
+
+ return $list;
+ }
+
+ private function indent($depth): string {
+ return $depth > 0 ? str_repeat(' ', $depth) : '';
+ }
+
+ private function simplelist_format_inline() {
+ return implode(", ", $this->cchunk["simplelist"]["members"]) . '';
+ }
+
+ private function simplelist_format_horizontal($depth) {
+ return $this->chunkReduceTable(
+ $this->processTabular(
+ $this->cchunk["simplelist"]["members"],
+ $this->cchunk["simplelist"]["columns"],
+ $depth),
+ $this->cchunk["simplelist"]["columns"],
+ $depth
+ );
+ }
+
+ /** Return formatted rows */
+ private function chunkReduceTable(array $members, int $cols, int $depth): string
+ {
+ $trPadding = $this->indent($depth + 2);
+ return array_reduce(
+ array_chunk(
+ $members,
+ $cols,
+ ),
+ fn (string $carry, array $entry) => $carry . $trPadding . "';
+ }
+
+ $list = match ($this->cchunk["simplelist"]["type"]) {
+ "inline" => $this->simplelist_format_inline(),
+ "horiz" => $this->simplelist_format_horizontal($props["depth"])
+ . $this->indent($props["depth"] + 1) . "
\n"
+ . $this->indent($props["depth"]) . "
1. Function/method with no return type
-1. Function/method with no parameters
-1. Constructor with no parameters, no return type
-1. Simplelist with no type
+2. Simplelist with "inline" type
+ First, Second, Third, Fourth, Fifth, Sixth, Seventh +3. Simplelist with "vert" type, 3 columns
+First | +Fourth | +Seventh | +
Second | +Fifth | ++ |
Third | +Sixth | ++ |
4. Simplelist with "horiz" type, 4 columns
+First | +Second | +Third | +Fourth | +
Fifth | +Sixth | +Seventh | ++ |
2. Constructor with whitespace between name, parameters and return types
-$option
void)3. Destructor with whitespace between name, parameters and return types
-$option
void)