[Python-checkins] r63590 - in doctools/trunk: CHANGES doc/markup/desc.rst sphinx/directives/other.py

georg.brandl python-checkins at python.org
Sat May 24 21:29:21 CEST 2008


Author: georg.brandl
Date: Sat May 24 21:29:20 2008
New Revision: 63590

Log:
Provide rest "class" directive as "cssclass".


Modified:
   doctools/trunk/   (props changed)
   doctools/trunk/CHANGES
   doctools/trunk/doc/markup/desc.rst
   doctools/trunk/sphinx/directives/other.py

Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES	(original)
+++ doctools/trunk/CHANGES	Sat May 24 21:29:20 2008
@@ -49,7 +49,10 @@
 
 * 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)

Modified: doctools/trunk/doc/markup/desc.rst
==============================================================================
--- doctools/trunk/doc/markup/desc.rst	(original)
+++ doctools/trunk/doc/markup/desc.rst	Sat May 24 21:29:20 2008
@@ -167,6 +167,23 @@
    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

Modified: doctools/trunk/sphinx/directives/other.py
==============================================================================
--- doctools/trunk/sphinx/directives/other.py	(original)
+++ doctools/trunk/sphinx/directives/other.py	Sat May 24 21:29:20 2008
@@ -353,3 +353,19 @@
 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


More information about the Python-checkins mailing list