Home | Trees | Index | Help |
|
---|
Package docutils :: Package parsers :: Package rst :: Package directives |
|
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.
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.
Submodules | |
---|---|
|
Function Summary | |
---|---|
choice(argument,
values)
| |
class_option(argument)
| |
Locate and return a directive function from its language-dependent name. | |
Check for a valid flag option (no argument) and return None. | |
format_values(values)
| |
Check for a nonnegative integer argument; raise ValueError if not. | |
Return the path argument unwrapped (with newlines removed). | |
Register a nonstandard application-defined directive function. | |
Return the argument, unchanged. |
Variable Summary | |
---|---|
dict |
_directive_registry = {'figure': ('images', 'figure'), '...
|
dict |
_directives = {u'parsed-literal': <function parsed_liter...
|
dict |
_modules = {}
|
Function Details |
---|
directive(directive_name, language_module, document)Locate and return a directive function from its language-dependent name. If not found in the current language, check English. Return None if the named directive cannot be found. |
flag(argument)Check for a valid flag option (no argument) and return None. Raise ValueError if an argument is found. |
nonnegative_int(argument)Check for a nonnegative integer argument; raise ValueError if not. |
path(argument)Return the path argument unwrapped (with newlines removed). Raise ValueError if no argument is found or if the path contains internal whitespace. |
register_directive(name, directive)Register a nonstandard application-defined directive function. |
unchanged(argument)Return the argument, unchanged. Raise ValueError if no argument is found. |
Variable Details |
---|
_directives
|
_modules
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.0 on Tue Jul 22 05:31:05 2003 | http://epydoc.sf.net |