\phpDocumentor\Guides\RestructuredText\DirectivesDirective

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

Summary

Methods
Properties
Constants
getName()
process()
processNode()
processAction()
finalize()
wantCode()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

getName()

getName() : string

Get the directive name

Returns

string —

process()

process(\phpDocumentor\Guides\RestructuredText\Parser  $parser, \phpDocumentor\Guides\Nodes\Node|null  $node, string  $variable, string  $data, string[]  $options) : 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

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

Parameters

\phpDocumentor\Guides\RestructuredText\Parser $parser

the calling parser

\phpDocumentor\Guides\Nodes\Node|null $node

the node that follows the directive

string $variable

the variable name of the directive

string $data

the data of the directive (following ::)

string[] $options

the array of options for this directive

processNode()

processNode(\phpDocumentor\Guides\RestructuredText\Parser  $parser, string  $variable, string  $data, string[]  $options) : \phpDocumentor\Guides\Nodes\Node

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

The arguments are the same that process

Parameters

\phpDocumentor\Guides\RestructuredText\Parser $parser
string $variable
string $data
string[] $options

Returns

\phpDocumentor\Guides\Nodes\Node —

processAction()

processAction(\phpDocumentor\Guides\RestructuredText\Parser  $parser, string  $variable, string  $data, string[]  $options) : void

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

The arguments are the same that process

Parameters

\phpDocumentor\Guides\RestructuredText\Parser $parser
string $variable
string $data
string[] $options

finalize()

finalize(\phpDocumentor\Guides\Nodes\DocumentNode  $document) : void

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

Parameters

\phpDocumentor\Guides\Nodes\DocumentNode $document

wantCode()

wantCode() : bool

Should the following block be passed as a CodeNode?

Returns

bool —