This package contains directive implementation modules.
The interface for directive functions is as follows:
def directive_fn(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
code...
# Set function attributes:
directive_fn.arguments = ...
directive_fn.options = ...
direcitve_fn.content = ...
Parameters:
Function attributes, interpreted by the directive parser (which calls the directive function):
arguments: A 3-tuple specifying the expected positional arguments, or None if the directive has no arguments. The 3 items in the tuple are (required, optional, whitespace OK in last argument):
Arguments are normally single whitespace-separated words. The final argument may contain whitespace if the third item in the argument spec tuple is 1/True. If the form of the arguments is more complex, specify only one argument (either required or optional) and indicate that final whitespace is OK; the client code must do any context-sensitive parsing.
options: A dictionary, mapping known option names to conversion functions such as int or float. None or an empty dict implies no options to parse. Several directive option conversion functions are defined in this module.
Option conversion functions take a single parameter, the option argument (a string or None), validate it and/or convert it to the appropriate form. Conversion functions may raise ValueError and TypeError exceptions.
content: A boolean; true if content is allowed. Client code must handle the case where content is required but not supplied (an empty content list will be supplied).
Directive functions return a list of nodes which will be inserted into the document tree at the point where the directive was encountered (can be an empty list).
See Creating reStructuredText Directives for more information.