Provide rest "class" directive as "cssclass".

This commit is contained in:
Georg Brandl 2008-05-24 19:29:20 +00:00
parent 02b529bf52
commit 0cf8cc2c5d
3 changed files with 37 additions and 1 deletions

View File

@ -49,7 +49,10 @@ Bugs fixed
* Fix behavior of references to functions/methods with an explicit title. * Fix behavior of references to functions/methods with an explicit title.
* Support citation nodes in LaTeX writer.M v7 * Support citation nodes in LaTeX writer.
* Provide the standard "class" directive as "cssclass"; else it is
shadowed by the Sphinx-defined directive.
Release 0.3 (May 6, 2008) Release 0.3 (May 6, 2008)

View File

@ -167,6 +167,23 @@ The directives are:
Describes a class. The signature can include parentheses with parameters Describes a class. The signature can include parentheses with parameters
which will be shown as the constructor arguments. which will be shown as the constructor arguments.
Methods and attributes belonging to the class should be placed in this
directive's body. If they are placed outside, the supplied name should
contain the class name so that cross-references still work. Example::
.. class:: Foo
.. method:: quux()
-- or --
.. class:: Bar
.. method:: Bar.quux()
.. versionadded:: 0.4
The standard reST directive ``class`` is now provided by Sphinx under
the name ``cssclass``.
.. directive:: .. attribute:: name .. directive:: .. attribute:: name
Describes an object data attribute. The description should include Describes an object data attribute. The description should include

View File

@ -353,3 +353,19 @@ def tabularcolumns_directive(name, arguments, options, content, lineno,
tabularcolumns_directive.content = 0 tabularcolumns_directive.content = 0
tabularcolumns_directive.arguments = (1, 0, 1) tabularcolumns_directive.arguments = (1, 0, 1)
directives.register_directive('tabularcolumns', tabularcolumns_directive) directives.register_directive('tabularcolumns', tabularcolumns_directive)
# register the standard rst class directive under a different name
try:
# docutils 0.4
from docutils.parsers.rst.directives.misc import class_directive
directives.register_directive('cssclass', class_directive)
except ImportError:
try:
# docutils 0.5
from docutils.parsers.rst.directives.misc import Class
directives.register_directive('cssclass', Class)
except ImportError:
# whatever :)
pass