Skip to content

Commit

Permalink
[BUGFIX] Allow empty lines between field list items
Browse files Browse the repository at this point in the history
They are also allowed in Sphinx and we frequently have them in TYPO3.
  • Loading branch information
linawolf authored and jaapio committed Nov 30, 2023
1 parent a1d4770 commit e7e9766
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 e7e9766

Please sign in to comment.