Guides

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

Rule

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

Methods

__construct()

public __construct(InlineParser $inlineTokenParser) : mixed
Parameters
$inlineTokenParser : InlineParser

apply()

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

isWhiteline()

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

        
On this page

Search results