Skip to content

Commit

Permalink
Merge pull request #723 from phpDocumentor/bugfix/fieldlist-item
Browse files Browse the repository at this point in the history
[BUGFIX] Allow empty lines between field list items
  • Loading branch information
jaapio authored Nov 30, 2023
2 parents a1d4770 + e7e9766 commit 18d6275
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ public function apply(BlockContext $blockContext, CompoundNode|null $on = null):
while ($iterator->valid() && $this->isFieldLine($iterator->current())) {
$fieldListItemNodes[] = $this->createListItem($blockContext);
$iterator->next();
while ($iterator->valid() && LinesIterator::isEmptyLine($iterator->current())) {
$peek = $iterator->peek();
if (!LinesIterator::isEmptyLine($peek) && !$this->isFieldLine($peek)) {
break;
}

$iterator->next();
}
}

if ($on instanceof DocumentNode && !$on->isTitleFound()) {
Expand Down Expand Up @@ -173,8 +181,12 @@ private function createDefinition(
}
}

private function isFieldLine(string $currentLine): bool
private function isFieldLine(string|null $currentLine): bool
{
if ($currentLine === null) {
return false;
}

if (LinesIterator::isEmptyLine($currentLine)) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!-- content start -->
<div class="section" id="test">
<h1>Test</h1>

<table>
<tr>
<th>Version</th>

<td>
</td>
</tr>
<tr>
<th>Language</th>

<td>
<p>en</p> </td>
</tr>
<tr>
<th>Author</th>

<td>
<p>Contributors</p> </td>
</tr>
<tr>
<th>Rendered</th>

<td>
<p>Sun, 01 Jan 2023 12:00:00 +0000</p> </td>
</tr>
</table>

<p>Something else.</p>
</div>

<!-- content end -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
====
Test
====

:Version:
|release|

:Language:
en


:Author:
Contributors




:Rendered:
|today|

Something else.

0 comments on commit 18d6275

Please sign in to comment.