Skip to content

[1.x] Merge pull request #889 from phpDocumentor/bugfix/multiline-comments #894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
3 changes: 0 additions & 3 deletions tests/Functional/tests/comment-empty/comment-empty.html
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
<p>this is not a comment</p>
<blockquote>
<p>this is a blockquote</p>
</blockquote>
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ <h1>Document title</h1>
<p>A note without a class</p>
</div>

<blockquote class="highlights"><p>Block quote text.</p></blockquote>

</div>

<!-- content end -->
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ Document title

..
Block quote text.
This is a comment
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!-- content start -->
<div class="section" id="some-title">
<h1>Some Title</h1>

<p>This text is no comment</p>
</div>

<!-- content end -->
10 changes: 10 additions & 0 deletions tests/Integration/tests/comments/comment-multiline/input/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Some Title
==========

..
This whole indented block
is a comment.
Still in the comment.

This text is no comment
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- content start -->
<div class="section" id="some-title">
<h1>Some Title</h1>

<div class="admonition note">
<p>No comment!</p><p>This text is no comment</p>
</div>

<p>After the node</p>
</div>

<!-- content end -->
15 changes: 15 additions & 0 deletions tests/Integration/tests/comments/comment-nested/input/index.rst
Original file line number Diff line number Diff line change
@@ -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