summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-05-15 13:00:11 +0200
committerGeorg Brandl <georg@python.org>2011-05-15 13:00:11 +0200
commite44c7e00563271f162ecd680ae151c013ac6c462 (patch)
tree3bb30963722e617ec9ce4e122d16ef15e6597389
parent3ea4ee1aec7140401bda55786a7e27fdc699403f (diff)
downloadsphinx-e44c7e00563271f162ecd680ae151c013ac6c462.tar.gz
Closes #669: Respect the ``noindex`` flag option in py:module directives.
-rw-r--r--CHANGES2
-rw-r--r--sphinx/domains/python.py21
2 files changed, 14 insertions, 9 deletions
diff --git a/CHANGES b/CHANGES
index cc2dfca2..de7a620c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
Release 1.0.8 (in development)
==============================
+* #669: Respect the ``noindex`` flag option in py:module directives.
+
* #675: Fix IndexErrors when including nonexisting lines with
:rst:dir:`literalinclude`.
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py
index d2242cdd..0220afd0 100644
--- a/sphinx/domains/python.py
+++ b/sphinx/domains/python.py
@@ -381,15 +381,18 @@ class PyModule(Directive):
modname = self.arguments[0].strip()
noindex = 'noindex' in self.options
env.temp_data['py:module'] = modname
- env.domaindata['py']['modules'][modname] = \
- (env.docname, self.options.get('synopsis', ''),
- self.options.get('platform', ''), 'deprecated' in self.options)
- # make a duplicate entry in 'objects' to facilitate searching for the
- # module in PythonDomain.find_obj()
- env.domaindata['py']['objects'][modname] = (env.docname, 'module')
- targetnode = nodes.target('', '', ids=['module-' + modname], ismod=True)
- self.state.document.note_explicit_target(targetnode)
- ret = [targetnode]
+ ret = []
+ if not noindex:
+ env.domaindata['py']['modules'][modname] = \
+ (env.docname, self.options.get('synopsis', ''),
+ self.options.get('platform', ''), 'deprecated' in self.options)
+ # make a duplicate entry in 'objects' to facilitate searching for
+ # the module in PythonDomain.find_obj()
+ env.domaindata['py']['objects'][modname] = (env.docname, 'module')
+ targetnode = nodes.target('', '', ids=['module-' + modname],
+ ismod=True)
+ self.state.document.note_explicit_target(targetnode)
+ ret.append(targetnode)
# XXX this behavior of the module directive is a mess...
if 'platform' in self.options:
platform = self.options['platform']