Add add_generic_role().

This commit is contained in:
Georg Brandl
2009-01-22 20:01:01 +01:00
parent 9c552c5d33
commit bb291e5045
3 changed files with 13 additions and 0 deletions

View File

@@ -81,6 +81,9 @@ New features added
- There is now a ``Sphinx.add_lexer()`` method to be able to use
custom Pygments lexers easily.
- There is now ``Sphinx.add_generic_rol()`` to mirror the docutils'
own function.
* Other changes:
- Config overrides for single dict keys can now be given on the

View File

@@ -86,6 +86,13 @@ the following public API:
source, *role* the role function (see the `Docutils documentation
<http://docutils.sourceforge.net/docs/howto/rst-roles.html>`_ on details).
.. method:: Sphinx.add_generic_role(name, nodeclass)
Register a Docutils role that does nothing but wrap its contents in the
node given by *nodeclass*.
.. versionadded:: 0.6
.. method:: Sphinx.add_description_unit(directivename, rolename, indextemplate='', parse_node=None, ref_nodeclass=None)
This method is a very convenient way to add a new type of information that

View File

@@ -279,6 +279,9 @@ class Sphinx(object):
def add_role(self, name, role):
roles.register_canonical_role(name, role)
def add_generic_role(self, name, nodeclass):
roles.register_generic_role(name, nodeclass)
def add_description_unit(self, directivename, rolename, indextemplate='',
parse_node=None, ref_nodeclass=None):
additional_xref_types[directivename] = (rolename, indextemplate, parse_node)