Skip to content

Commit

Permalink
Merge pull request #271 from greg0ire/fix-dl
Browse files Browse the repository at this point in the history
Fix definition list bug
  • Loading branch information
greg0ire authored Jul 21, 2023
2 parents 06bc37c + 3677db5 commit 82f73b0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Parser/DocumentParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ private function parseLine(string $line): bool
return true;
}

if ($this->lineChecker->isIndented($this->lines->getNextLine())) {
if (trim($this->lines->getNextLine()) !== '' && $this->lineChecker->isIndented($this->lines->getNextLine())) {
$this->setState(State::DEFINITION_LIST);
$this->buffer->push($line);

Expand Down
10 changes: 10 additions & 0 deletions tests/Functional/tests/render/definition-list/definition-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,13 @@ <h1>
</dd>
</dl>
</div>
<div class="section" id="not-a-definition-list">
<h1>
Not a definition list
</h1>
<p>Single line followed by a blank line</p>
<blockquote>
<p>This line is indented, but because of the blank line, it should
not be considered a term. It is a blockquote.</p>
</blockquote>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,11 @@ term 1
.. note::

directive in definition list

Not a definition list
=====================

Single line followed by a blank line

This line is indented, but because of the blank line, it should
not be considered a term. It is a blockquote.

0 comments on commit 82f73b0

Please sign in to comment.