Commit: 2e6e92cf50f3f0845757e1bd6afe8814e93d13f7
Author: Sybren A. Stüvel
Date:   Sun Feb 1 14:00:37 2015 +0100
Branches: master
https://developer.blender.org/rB2e6e92cf50f3f0845757e1bd6afe8814e93d13f7

Documentation: Support documenting constructors in class __doc__

Python types defined in C can now start their docstring with a
`.. class:: TypeName(args)` line, to document their constructor.
In that case the documentation writer is responsible for indenting the
remainder of the docstring by 3 spaces, matching the generated
documentation.

===================================================================

M       doc/python_api/sphinx_doc_gen.py

===================================================================

diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 7ffb448..344e676 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -937,10 +937,16 @@ def pymodule2sphinx(basepath, module_name, module, title):
                 fw(title_string(heading, heading_char))
 
         # May need to be its own function
-        fw(".. class:: %s\n\n" % type_name)
         if value.__doc__:
-            write_indented_lines("   ", fw, value.__doc__, False)
-            fw("\n")
+            if value.__doc__.startswith(".. class::"):
+                fw(value.__doc__)
+            else:
+                fw(".. class:: %s\n\n" % type_name)
+                write_indented_lines("   ", fw, value.__doc__, False)
+        else:
+            fw(".. class:: %s\n\n" % type_name)
+        fw("\n")
+
         write_example_ref("   ", fw, module_name + "." + type_name)
 
         descr_items = [(key, descr) for key, descr in 
sorted(value.__dict__.items()) if not key.startswith("__")]

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to