Anonymous avatar Anonymous committed e5979a5

Render .. automodule:: docstrings in a section node, and
ignore section styles in the document, so that module docstrings
can contain proper sections.

Comments (0)

Files changed (2)

 * sphinx.environment: Move doctest_blocks out of block_quotes to
   support indented doctest blocks.
 
+* sphinx.ext.autodoc: Render .. automodule:: docstrings in a setion
+  node, so that module docstrings can contain proper sectioning.
+
 
 Release 0.1.61611 (Mar 21, 2008)
 ================================

sphinx/ext/autodoc.py

     warnings, result = generate_rst(what, name, members, undoc, content,
                                     state.document, lineno)
 
-    node = nodes.paragraph()
-    state.nested_parse(result, content_offset, node)
-    return warnings + [node]
+    if dirname == 'automodule':
+        node = nodes.section()
+        # hack around title style bookkeeping
+        surrounding_title_styles = state.memo.title_styles
+        surrounding_section_level = state.memo.section_level
+        state.memo.title_styles = []
+        state.memo.section_level = 0
+        state.nested_parse(result, content_offset, node, match_titles=1)
+        state.memo.title_styles = surrounding_title_styles
+        state.memo.section_level = surrounding_section_level
+    else:
+        node = nodes.paragraph()
+        state.nested_parse(result, content_offset, node)
+    return warnings + node.children
 
 def auto_directive(*args, **kwds):
     return _auto_directive(*args, **kwds)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.