diff --git a/CHANGES b/CHANGES index b61cfd3a0..5c4cc5f97 100644 --- a/CHANGES +++ b/CHANGES @@ -49,7 +49,10 @@ Bugs fixed * 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) diff --git a/doc/markup/desc.rst b/doc/markup/desc.rst index 9c84e20dc..1028ab37d 100644 --- a/doc/markup/desc.rst +++ b/doc/markup/desc.rst @@ -167,6 +167,23 @@ The directives are: Describes a class. The signature can include parentheses with parameters 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 Describes an object data attribute. The description should include diff --git a/sphinx/directives/other.py b/sphinx/directives/other.py index 29fd12f8e..46cb04c4c 100644 --- a/sphinx/directives/other.py +++ b/sphinx/directives/other.py @@ -353,3 +353,19 @@ def tabularcolumns_directive(name, arguments, options, content, lineno, tabularcolumns_directive.content = 0 tabularcolumns_directive.arguments = (1, 0, 1) 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