From e7a6c0c9c4fe47c76b0f8414f8d9b9f9e7e9565b Mon Sep 17 00:00:00 2001 From: haszi Date: Thu, 25 Apr 2024 17:32:26 +0200 Subject: [PATCH] Render elements in simplelist members correctly (#117) Co-authored-by: haszi --- phpdotnet/phd/Package/Generic/XHTML.php | 11 +++++----- tests/package/generic/data/simplelist.xml | 26 +++++++++++++++++++++++ tests/package/generic/simplelist_001.phpt | 18 ++++++++++++++++ 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/phpdotnet/phd/Package/Generic/XHTML.php b/phpdotnet/phd/Package/Generic/XHTML.php index dc789933..b35c975e 100644 --- a/phpdotnet/phd/Package/Generic/XHTML.php +++ b/phpdotnet/phd/Package/Generic/XHTML.php @@ -2166,6 +2166,11 @@ public function format_member($open, $name, $attrs, $props) { if ($this->cchunk["simplelist"]["type"] === "inline" || $this->cchunk["simplelist"]["type"] === "vert" || $this->cchunk["simplelist"]["type"] === "horiz") { + $this->appendToBuffer = $open; + if (! $open) { + $this->cchunk["simplelist"]["members"][] = $this->buffer; + } + $this->buffer = ''; return ''; } if ($open) { @@ -2175,12 +2180,6 @@ public function format_member($open, $name, $attrs, $props) { } public function format_member_text($value, $tag) { - if ($this->cchunk["simplelist"]["type"] === "inline" - || $this->cchunk["simplelist"]["type"] === "vert" - || $this->cchunk["simplelist"]["type"] === "horiz") { - $this->cchunk["simplelist"]["members"][] = $value; - return ''; - } return $value; } diff --git a/tests/package/generic/data/simplelist.xml b/tests/package/generic/data/simplelist.xml index ce3e5d5b..895f2175 100644 --- a/tests/package/generic/data/simplelist.xml +++ b/tests/package/generic/data/simplelist.xml @@ -53,4 +53,30 @@ +
+ 5. Simplelist with no type and various elements inside members + + 1 First + 2 Second + 3 Third + 4 Fourth + 5 Fifth + 6 Sixth + 7 Seventh + +
+ +
+ 6. Simplelist with "inline" type and various elements inside members + + 1 First + 2 Second + 3 Third + 4 Fourth + 5 Fifth + 6 Sixth + 7 Seventh + +
+ diff --git a/tests/package/generic/simplelist_001.phpt b/tests/package/generic/simplelist_001.phpt index 5be5acdb..b9997ca7 100644 --- a/tests/package/generic/simplelist_001.phpt +++ b/tests/package/generic/simplelist_001.phpt @@ -81,4 +81,22 @@ Content: +
+

5. Simplelist with no type and various elements inside members

+
    +
  • 1 First
  • +
  • 2 Second
  • +
  • 3 Third
  • +
  • 4 Fourth
  • +
  • 5 Fifth
  • +
  • 6 Sixth
  • +
  • 7 Seventh
  • +
+
+ +
+

6. Simplelist with "inline" type and various elements inside members

+ 1 First, 2 Second, 3 Third, 4 Fourth, 5 Fifth, 6 Sixth, 7 Seventh +
+