Documentation

VersionAddedDirective extends SubDirective
in package

A directive that parses the sub block and call the processSub that can be overloaded, like :

.. sub-directive:: Some block of code

You can imagine anything here, like adding emphasis, lists or titles

Table of Contents

finalize()  : void
Called at the end of the parsing to finalize the document (add something or tweak nodes)
getName()  : string
process()  : void
This is the function called by the parser to process the directive, it can be overloaded to do anything with the document, like tweaking nodes or change the environment
processAction()  : void
This can be overloaded to write a directive that just do an action without changing the nodes of the document
processNode()  : Node
This can be overloaded to write a directive that just create one node for the document, which is common
processSub()  : Node|null
wantCode()  : bool
Should the following block be passed as a CodeNode?

Methods

finalize()

Called at the end of the parsing to finalize the document (add something or tweak nodes)

public finalize(DocumentNode $document) : void
Parameters
$document : DocumentNode
Return values
void

process()

This is the function called by the parser to process the directive, it can be overloaded to do anything with the document, like tweaking nodes or change the environment

public process(Parser $parser, Node|null $node, string $variable, string $data, array<string|int, string> $options) : void

The node that directly follows the directive is also passed to it

Parameters
$parser : Parser

the calling parser

$node : Node|null

the node that follows the directive

$variable : string

the variable name of the directive

$data : string

the data of the directive (following ::)

$options : array<string|int, string>

the array of options for this directive

Return values
void

processAction()

This can be overloaded to write a directive that just do an action without changing the nodes of the document

public processAction(Parser $parser, string $variable, string $data, array<string|int, string> $options) : void

The arguments are the same that process

Parameters
$parser : Parser
$variable : string
$data : string
$options : array<string|int, string>
Return values
void

processNode()

This can be overloaded to write a directive that just create one node for the document, which is common

public processNode(Parser $parser, string $variable, string $data, array<string|int, string> $options) : Node

The arguments are the same that process

Parameters
$parser : Parser
$variable : string
$data : string
$options : array<string|int, string>
Return values
Node

processSub()

public processSub(Parser $parser, Node|null $document, string $variable, string $data, array<string|int, mixed> $options) : Node|null
Parameters
$parser : Parser
$document : Node|null
$variable : string
$data : string
$options : array<string|int, mixed>
Return values
Node|null

wantCode()

Should the following block be passed as a CodeNode?

public wantCode() : bool
Return values
bool

Search results