Guides

CommentRule
in package
implements Rule

FinalYes
Tags
link
https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#comments

Table of Contents

Interfaces

Rule

Constants

PRIORITY  = 60

Methods

applies()  : bool
apply()  : TNode|null
Enters this state and loops through all relevant lines until a Node is produced.
isComment()  : bool
Every explicit markup block which is not a valid markup construct is regarded as a comment.
isCommentLine()  : bool

Constants

Methods

apply()

Enters this state and loops through all relevant lines until a Node is produced.

public apply(BlockContext $blockContext[, CompoundNode|null $on = null ]) : TNode|null

The opening line is considered relevant and as such is always used (this is found the case in the self::Applies() method, otherwise we wouldn't have been here) but for all subsequent lines we use a Look Ahead to test whether it should be included in the Node.

By using a Look Ahead, we prevent the cursor from advancing; and this caused the cursor to 'rest' on the line that is considered that last relevant line. The document parser will advance the line after successfully parsing this and to send the Parser into a line that belongs to another state.

Parameters
$blockContext : BlockContext
$on : CompoundNode|null = null
Return values
TNode|null

isComment()

Every explicit markup block which is not a valid markup construct is regarded as a comment.

private isComment(string $line) : bool
Parameters
$line : string
Return values
bool

isCommentLine()

private isCommentLine(string|null $line) : bool
Parameters
$line : string|null
Return values
bool

        
On this page

Search results