Skip to content

Commit 8a00a52

Browse files
committed
[BUGFIX] Multiline comments may contain empty lines
1 parent d1abce0 commit 8a00a52

File tree

5 files changed

+46
-1
lines changed

5 files changed

+46
-1
lines changed

packages/guides-restructured-text/src/RestructuredText/Parser/Productions/CommentRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private function isCommentLine(string|null $line): bool
5656
return false;
5757
}
5858

59-
return $this->isComment($line) || (trim($line) !== '' && $line[0] === ' ');
59+
return $this->isComment($line) || trim($line) === '' || $line[0] === ' ';
6060
}
6161

6262
private function isComment(string $line): bool
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!-- content start -->
2+
<div class="section" id="some-title">
3+
<h1>Some Title</h1>
4+
5+
<p>This text is no comment</p>
6+
</div>
7+
8+
<!-- content end -->
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Some Title
2+
==========
3+
4+
..
5+
This whole indented block
6+
is a comment.
7+
8+
Still in the comment.
9+
10+
This text is no comment
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!-- content start -->
2+
<div class="section" id="some-title">
3+
<h1>Some Title</h1>
4+
5+
<div class="admonition note">
6+
<p>No comment!</p><p>This text is no comment</p>
7+
</div>
8+
9+
<p>After the node</p>
10+
</div>
11+
12+
<!-- content end -->
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Some Title
2+
==========
3+
4+
.. note::
5+
No comment!
6+
7+
..
8+
This whole indented block
9+
is a comment.
10+
11+
Still in the comment.
12+
13+
This text is no comment
14+
15+
After the node

0 commit comments

Comments
 (0)