mirror of
https://github.com/doctrine/rst-parser.git
synced 2026-03-23 22:42:06 +01:00
Check if indented line is blank
Definition list are composed by a term and a definition block. The term and the definition block may not be separated by a blank line. Lines with only whitespace are considered blank.
This commit is contained in:
@@ -309,7 +309,7 @@ final class DocumentParser
|
||||
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);
|
||||
|
||||
|
||||
@@ -94,3 +94,13 @@ definition 2 </dd>
|
||||
</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>
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user