Package docutils :: Package parsers :: Package rst :: Package directives
[show private | hide private]
[frames | no frames]

Package docutils.parsers.rst.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):

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
  • admonitions: Admonition directives.
  • body: Directives for additional body elements.
  • html: Directives for typically HTML-specific constructs.
  • images: Directives for figures and simple images.
  • misc: Miscellaneous directives.
  • parts: Directives for document parts.
  • references: Directives for references and targets.

Function Summary
  choice(argument, values)
  class_option(argument)
  directive(directive_name, language_module, document)
Locate and return a directive function from its language-dependent name.
  flag(argument)
Check for a valid flag option (no argument) and return None.
  format_values(values)
  nonnegative_int(argument)
Check for a nonnegative integer argument; raise ValueError if not.
  path(argument)
Return the path argument unwrapped (with newlines removed).
  register_directive(name, directive)
Register a nonstandard application-defined directive function.
  unchanged(argument)
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

_directive_registry

Type:
dict
Value:
{'admonition': ('admonitions', 'admonition'),
 'attention': ('admonitions', 'attention'),
 'caution': ('admonitions', 'caution'),
 'class': ('misc', 'class_directive'),
 'contents': ('parts', 'contents'),
 'danger': ('admonitions', 'danger'),
 'epigraph': ('body', 'epigraph'),
 'error': ('admonitions', 'error'),
...                                                                    

_directives

Type:
dict
Value:
{u'parsed-literal': <function parsed_literal at 0x8372fe4>}            

_modules

Type:
dict
Value:
{}                                                                     

Generated by Epydoc 2.0 on Tue Jul 22 05:31:05 2003 http://epydoc.sf.net