diff --git a/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/CommentRule.php b/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/CommentRule.php index 4083325d1..ae48f8953 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/CommentRule.php +++ b/packages/guides-restructured-text/src/RestructuredText/Parser/Productions/CommentRule.php @@ -56,11 +56,11 @@ private function isCommentLine(string|null $line): bool return false; } - return $this->isComment($line) || (trim($line) !== '' && $line[0] === ' '); + return $this->isComment($line) || trim($line) === '' || $line[0] === ' '; } private function isComment(string $line): bool { - return trim($line) === '..' || preg_match('/^\.\.\s+.*$/mUsi', $line) > 0; + return trim($line) === '..' || preg_match('/^\.\.\s+[^:]*$/mUsi', $line) > 0; } } diff --git a/tests/Functional/tests/comment-empty/comment-empty.html b/tests/Functional/tests/comment-empty/comment-empty.html index 9ba15270b..92b8ea639 100644 --- a/tests/Functional/tests/comment-empty/comment-empty.html +++ b/tests/Functional/tests/comment-empty/comment-empty.html @@ -1,4 +1 @@

this is not a comment

-
-

this is a blockquote

-
diff --git a/tests/Integration/tests/class/class-directive/expected/index.html b/tests/Integration/tests/class/class-directive/expected/index.html index 97e674241..12fb9eb21 100644 --- a/tests/Integration/tests/class/class-directive/expected/index.html +++ b/tests/Integration/tests/class/class-directive/expected/index.html @@ -20,8 +20,6 @@

Document title

A note without a class

-

Block quote text.

- diff --git a/tests/Integration/tests/class/class-directive/input/index.rst b/tests/Integration/tests/class/class-directive/input/index.rst index 2cf2194be..6464aee47 100644 --- a/tests/Integration/tests/class/class-directive/input/index.rst +++ b/tests/Integration/tests/class/class-directive/input/index.rst @@ -37,4 +37,4 @@ Document title .. - Block quote text. + This is a comment diff --git a/tests/Integration/tests/comments/comment-multiline/expected/index.html b/tests/Integration/tests/comments/comment-multiline/expected/index.html new file mode 100644 index 000000000..11b1e2498 --- /dev/null +++ b/tests/Integration/tests/comments/comment-multiline/expected/index.html @@ -0,0 +1,8 @@ + +
+

Some Title

+ +

This text is no comment

+
+ + diff --git a/tests/Integration/tests/comments/comment-multiline/input/index.rst b/tests/Integration/tests/comments/comment-multiline/input/index.rst new file mode 100644 index 000000000..e3b74b8b9 --- /dev/null +++ b/tests/Integration/tests/comments/comment-multiline/input/index.rst @@ -0,0 +1,10 @@ +Some Title +========== + +.. + This whole indented block + is a comment. + + Still in the comment. + +This text is no comment \ No newline at end of file diff --git a/tests/Integration/tests/comments/comment-nested/expected/index.html b/tests/Integration/tests/comments/comment-nested/expected/index.html new file mode 100644 index 000000000..b20cee5be --- /dev/null +++ b/tests/Integration/tests/comments/comment-nested/expected/index.html @@ -0,0 +1,12 @@ + +
+

Some Title

+ +
+

No comment!

This text is no comment

+
+ +

After the node

+
+ + diff --git a/tests/Integration/tests/comments/comment-nested/input/index.rst b/tests/Integration/tests/comments/comment-nested/input/index.rst new file mode 100644 index 000000000..91b2efe56 --- /dev/null +++ b/tests/Integration/tests/comments/comment-nested/input/index.rst @@ -0,0 +1,15 @@ +Some Title +========== + +.. note:: + No comment! + + .. + This whole indented block + is a comment. + + Still in the comment. + + This text is no comment + +After the node