Skip to content

Commit cb1befb

Browse files
authored
Merge pull request #894 from phpDocumentor/backport/1.x/pr-889
[1.x] Merge pull request #889 from phpDocumentor/bugfix/multiline-comments
2 parents 6632d2e + a5f999a commit cb1befb

File tree

8 files changed

+48
-8
lines changed

8 files changed

+48
-8
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ 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
6363
{
64-
return trim($line) === '..' || preg_match('/^\.\.\s+.*$/mUsi', $line) > 0;
64+
return trim($line) === '..' || preg_match('/^\.\.\s+[^:]*$/mUsi', $line) > 0;
6565
}
6666
}
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
11
<p>this is not a comment</p>
2-
<blockquote>
3-
<p>this is a blockquote</p>
4-
</blockquote>

tests/Integration/tests/class/class-directive/expected/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ <h1>Document title</h1>
2020
<p>A note without a class</p>
2121
</div>
2222

23-
<blockquote class="highlights"><p>Block quote text.</p></blockquote>
24-
2523
</div>
2624

2725
<!-- content end -->

tests/Integration/tests/class/class-directive/input/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ Document title
3737

3838
..
3939
40-
Block quote text.
40+
This is a comment
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)