mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Render .. automodule:: docstrings in a section node, and
ignore section styles in the document, so that module docstrings can contain proper sections.
This commit is contained in:
parent
4a53c7c96f
commit
e0bdea6b28
3
CHANGES
3
CHANGES
@ -11,6 +11,9 @@ Changes in trunk
|
||||
* 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)
|
||||
================================
|
||||
|
@ -192,9 +192,20 @@ def _auto_directive(dirname, arguments, options, content, lineno,
|
||||
warnings, result = generate_rst(what, name, members, undoc, content,
|
||||
state.document, lineno)
|
||||
|
||||
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]
|
||||
return warnings + node.children
|
||||
|
||||
def auto_directive(*args, **kwds):
|
||||
return _auto_directive(*args, **kwds)
|
||||
|
Loading…
Reference in New Issue
Block a user