BlockQuoteRule
in package
implements
Rule
Tags
Table of Contents
Interfaces
Constants
- PRIORITY = 100
Properties
Methods
- __construct() : mixed
- applies() : bool
- apply() : TNode|null
- Enters this state and loops through all relevant lines until a Node is produced.
- isBlockLine() : bool
- isIndented() : bool
- Check if line is an indented one.
- removeLeadingWhitelines() : array<string|int, string>
Constants
PRIORITY
public
mixed
PRIORITY
= 100
Properties
$startingRule read-only
private
Rule
$startingRule
Methods
__construct()
public
__construct(Rule<string|int, CollectionNode> $startingRule) : mixed
Parameters
- $startingRule : Rule<string|int, CollectionNode>
applies()
public
applies(BlockContext $blockContext) : bool
Parameters
- $blockContext : BlockContext
Return values
boolapply()
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|nullisBlockLine()
private
isBlockLine(string|null $line[, int $minIndent = 1 ]) : bool
Parameters
- $line : string|null
- $minIndent : int = 1
Return values
boolisIndented()
Check if line is an indented one.
private
isIndented(string $line, int $minIndent) : bool
This does not include blank lines, use isBlockLine() to check for blank or indented lines.
Parameters
- $line : string
- $minIndent : int
-
can be used to require a specific level of indentation (number of spaces)
Return values
boolremoveLeadingWhitelines()
private
removeLeadingWhitelines(array<string|int, string> $lines) : array<string|int, string>
Parameters
- $lines : array<string|int, string>