InlineMarkupRule
in package
implements
Rule
FinalYes
The Inline markup produces inline nodes
This rule is a special rule, as it is not capable to collect content by itself. There is no way we can determine the end of an inline block.
Just like a Paragraph the start and end are marked by white lines. But as the parent can be any kind of node, the end should be marked by the caller. The best way to use this rule is using a buffer. The buffer allows you to collect all lines until the end of the block and pass them at once into this rule.
$buffer = new Buffer();
while ($this->isEnd($blockContext->getDocumentIterator()->getNextLine()) === false) {
$buffer->push($blockContext->getDocumentIterator()->current());
}
$inlineRule = new InlineMarkupRule($spanParser);
$node = $inlineRule->apply($documentParser->withContents($buffer->getLinesString()), new MyNode());
Table of Contents
Interfaces
Properties
- $inlineTokenParser : InlineParser
Methods
- __construct() : mixed
- applies() : bool
- apply() : mixed
- Enters this state and loops through all relevant lines until a Node is produced.
- collectContent() : Buffer
- isWhiteline() : bool
Properties
$inlineTokenParser read-only
private
InlineParser
$inlineTokenParser
Methods
__construct()
public
__construct(InlineParser $inlineTokenParser) : mixed
Parameters
- $inlineTokenParser : InlineParser
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[, TParent|null $on = null ]) : mixed
Parameters
- $blockContext : BlockContext
- $on : TParent|null = null
collectContent()
private
collectContent(LinesIterator $documentIterator) : Buffer
Parameters
- $documentIterator : LinesIterator
Return values
BufferisWhiteline()
private
isWhiteline(string|null $line) : bool
Parameters
- $line : string|null