mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Access domain data via env.domaindata.
This commit is contained in:
@@ -242,7 +242,7 @@ class StandaloneHTMLBuilder(Builder):
|
||||
rellinks.append(('genindex', _('General Index'), 'I', _('index')))
|
||||
# XXX generalization of modindex?
|
||||
if self.config.html_use_modindex and \
|
||||
self.env.domains['py'].data['modules']:
|
||||
self.env.domaindata['py']['modules']:
|
||||
rellinks.append(('modindex', _('Global Module Index'),
|
||||
'M', _('modules')))
|
||||
|
||||
@@ -407,7 +407,7 @@ class StandaloneHTMLBuilder(Builder):
|
||||
|
||||
# the global module index
|
||||
|
||||
moduleindex = self.env.domains['py'].data['modules']
|
||||
moduleindex = self.env.domaindata['py']['modules']
|
||||
if self.config.html_use_modindex and moduleindex:
|
||||
# the sorted list of all modules, for the global module index
|
||||
modules = sorted(((mn, (self.get_relative_uri('modindex', fn) +
|
||||
|
||||
@@ -214,7 +214,7 @@ class PythonDesc(DescDirective):
|
||||
signode['ids'].append(fullname)
|
||||
signode['first'] = (not self.names)
|
||||
self.state.document.note_explicit_target(signode)
|
||||
objects = self.env.domains['py'].data['objects']
|
||||
objects = self.env.domaindata['py']['objects']
|
||||
if fullname in objects:
|
||||
self.env.warn(
|
||||
self.env.docname,
|
||||
@@ -383,7 +383,7 @@ class PyModule(Directive):
|
||||
modname = self.arguments[0].strip()
|
||||
noindex = 'noindex' in self.options
|
||||
env.currmodule = modname
|
||||
env.domains['py'].data['modules'][modname] = \
|
||||
env.domaindata['py']['modules'][modname] = \
|
||||
(env.docname, self.options.get('synopsis', ''),
|
||||
self.options.get('platform', ''), 'deprecated' in self.options)
|
||||
modulenode = addnodes.module()
|
||||
@@ -683,7 +683,7 @@ class CDesc(DescDirective):
|
||||
signode['ids'].append(name)
|
||||
signode['first'] = (not self.names)
|
||||
self.state.document.note_explicit_target(signode)
|
||||
inv = self.env.domains['c'].data['objects']
|
||||
inv = self.env.domaindata['c']['objects']
|
||||
if name in inv:
|
||||
self.env.warn(
|
||||
self.env.docname,
|
||||
|
||||
@@ -79,7 +79,7 @@ class CoverageBuilder(Builder):
|
||||
|
||||
def build_c_coverage(self):
|
||||
# Fetch all the info from the header files
|
||||
c_objects = self.env.domains['c'].data['objects']
|
||||
c_objects = self.env.domaindata['c']['objects']
|
||||
for filename in self.c_sourcefiles:
|
||||
undoc = []
|
||||
f = open(filename, 'r')
|
||||
@@ -117,8 +117,8 @@ class CoverageBuilder(Builder):
|
||||
op.close()
|
||||
|
||||
def build_py_coverage(self):
|
||||
objects = self.env.domains['py'].data['objects']
|
||||
modules = self.env.domains['py'].data['modules']
|
||||
objects = self.env.domaindata['py']['objects']
|
||||
modules = self.env.domaindata['py']['modules']
|
||||
|
||||
for mod_name in modules:
|
||||
ignore = False
|
||||
|
||||
@@ -92,7 +92,7 @@ def test_second_update():
|
||||
assert 'autodoc' not in env.found_docs
|
||||
|
||||
def test_object_inventory():
|
||||
refs = env.domains['py'].data['objects']
|
||||
refs = env.domaindata['py']['objects']
|
||||
|
||||
assert 'func_without_module' in refs
|
||||
assert refs['func_without_module'] == ('desc', 'function')
|
||||
@@ -109,5 +109,8 @@ def test_object_inventory():
|
||||
assert 'func_in_module' not in refs
|
||||
assert 'func_noindex' not in refs
|
||||
|
||||
assert env.domains['py'].data['modules']['mod'] == \
|
||||
assert env.domaindata['py']['modules']['mod'] == \
|
||||
('desc', 'Module synopsis.', 'UNIX', False)
|
||||
|
||||
assert env.domains['py'].data is env.domaindata['py']
|
||||
assert env.domains['c'].data is env.domaindata['c']
|
||||
|
||||
Reference in New Issue
Block a user