Directive
in package
A directive is like a function you can call or apply to a block Il looks like:
.. function:: main :arg1: value :arg2: otherValue
Some block !
The directive can define variables, create special nodes or change the node that directly follows it
Table of Contents
- finalize() : void
- Called at the end of the parsing to finalize the document (add something or tweak nodes)
- getName() : string
- Get the directive name
- 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
- 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 —getName()
Get the directive name
public
abstract getName() : string
Return values
string —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 —wantCode()
Should the following block be passed as a CodeNode?
public
wantCode() : bool