mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #4903 from tk0miya/4885_revert_merge_domaindata
Revert #4882; f4f693eff7
This commit is contained in:
commit
f64e6a82c8
@ -19,7 +19,6 @@ from sphinx.directives import ObjectDescription
|
|||||||
from sphinx.domains import Domain, ObjType
|
from sphinx.domains import Domain, ObjType
|
||||||
from sphinx.locale import l_, _
|
from sphinx.locale import l_, _
|
||||||
from sphinx.roles import XRefRole
|
from sphinx.roles import XRefRole
|
||||||
from sphinx.util import logging
|
|
||||||
from sphinx.util.docfields import Field, TypedField
|
from sphinx.util.docfields import Field, TypedField
|
||||||
from sphinx.util.nodes import make_refnode
|
from sphinx.util.nodes import make_refnode
|
||||||
|
|
||||||
@ -30,8 +29,6 @@ if False:
|
|||||||
from sphinx.builders import Builder # NOQA
|
from sphinx.builders import Builder # NOQA
|
||||||
from sphinx.environment import BuildEnvironment # NOQA
|
from sphinx.environment import BuildEnvironment # NOQA
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
# RE to split at word boundaries
|
# RE to split at word boundaries
|
||||||
wsplit_re = re.compile(r'(\W+)')
|
wsplit_re = re.compile(r'(\W+)')
|
||||||
@ -290,13 +287,9 @@ class CDomain(Domain):
|
|||||||
|
|
||||||
def merge_domaindata(self, docnames, otherdata):
|
def merge_domaindata(self, docnames, otherdata):
|
||||||
# type: (List[unicode], Dict) -> None
|
# type: (List[unicode], Dict) -> None
|
||||||
|
# XXX check duplicates
|
||||||
for fullname, (fn, objtype) in otherdata['objects'].items():
|
for fullname, (fn, objtype) in otherdata['objects'].items():
|
||||||
if fn in docnames:
|
if fn in docnames:
|
||||||
if fullname in self.data['objects']:
|
|
||||||
other, _ = self.data['objects'][fullname]
|
|
||||||
logger.warning('duplicate C object description of %s, '
|
|
||||||
'other instance in %s' %
|
|
||||||
(fullname, self.env.doc2path(other)))
|
|
||||||
self.data['objects'][fullname] = (fn, objtype)
|
self.data['objects'][fullname] = (fn, objtype)
|
||||||
|
|
||||||
def resolve_xref(self, env, fromdocname, builder,
|
def resolve_xref(self, env, fromdocname, builder,
|
||||||
|
@ -18,7 +18,6 @@ from sphinx.domains import Domain, ObjType
|
|||||||
from sphinx.domains.python import _pseudo_parse_arglist
|
from sphinx.domains.python import _pseudo_parse_arglist
|
||||||
from sphinx.locale import l_, _
|
from sphinx.locale import l_, _
|
||||||
from sphinx.roles import XRefRole
|
from sphinx.roles import XRefRole
|
||||||
from sphinx.util import logging
|
|
||||||
from sphinx.util.docfields import Field, GroupedField, TypedField
|
from sphinx.util.docfields import Field, GroupedField, TypedField
|
||||||
from sphinx.util.nodes import make_refnode
|
from sphinx.util.nodes import make_refnode
|
||||||
|
|
||||||
@ -30,8 +29,6 @@ if False:
|
|||||||
from sphinx.builders import Builder # NOQA
|
from sphinx.builders import Builder # NOQA
|
||||||
from sphinx.environment import BuildEnvironment # NOQA
|
from sphinx.environment import BuildEnvironment # NOQA
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class JSObject(ObjectDescription):
|
class JSObject(ObjectDescription):
|
||||||
"""
|
"""
|
||||||
@ -258,12 +255,6 @@ class JSModule(Directive):
|
|||||||
noindex = 'noindex' in self.options
|
noindex = 'noindex' in self.options
|
||||||
ret = []
|
ret = []
|
||||||
if not noindex:
|
if not noindex:
|
||||||
modules = env.domaindata['js']['modules']
|
|
||||||
if mod_name in modules:
|
|
||||||
self.state_machine.reporter.warning(
|
|
||||||
'duplicate module description of %s, ' % mod_name +
|
|
||||||
'other instance in ' + env.doc2path(modules[mod_name]),
|
|
||||||
line=self.lineno)
|
|
||||||
env.domaindata['js']['modules'][mod_name] = env.docname
|
env.domaindata['js']['modules'][mod_name] = env.docname
|
||||||
# Make a duplicate entry in 'objects' to facilitate searching for
|
# Make a duplicate entry in 'objects' to facilitate searching for
|
||||||
# the module in JavaScriptDomain.find_obj()
|
# the module in JavaScriptDomain.find_obj()
|
||||||
@ -344,21 +335,12 @@ class JavaScriptDomain(Domain):
|
|||||||
|
|
||||||
def merge_domaindata(self, docnames, otherdata):
|
def merge_domaindata(self, docnames, otherdata):
|
||||||
# type: (List[unicode], Dict) -> None
|
# type: (List[unicode], Dict) -> None
|
||||||
|
# XXX check duplicates
|
||||||
for fullname, (fn, objtype) in otherdata['objects'].items():
|
for fullname, (fn, objtype) in otherdata['objects'].items():
|
||||||
if fn in docnames:
|
if fn in docnames:
|
||||||
if fullname in self.data['objects']:
|
|
||||||
otherdoc, _ = self.data['objects'][fullname]
|
|
||||||
logger.warning('duplicate object description of %s, '
|
|
||||||
'other instance in %s' %
|
|
||||||
(fullname, self.env.doc2path(otherdoc)))
|
|
||||||
self.data['objects'][fullname] = (fn, objtype)
|
self.data['objects'][fullname] = (fn, objtype)
|
||||||
for mod_name, pkg_docname in otherdata['modules'].items():
|
for mod_name, pkg_docname in otherdata['modules'].items():
|
||||||
if pkg_docname in docnames:
|
if pkg_docname in docnames:
|
||||||
if mod_name in self.data['modules']:
|
|
||||||
otherdoc = self.data['modules'][mod_name]
|
|
||||||
logger.warning('duplicate module description of %s, '
|
|
||||||
'other instance in %s' %
|
|
||||||
(mod_name, self.env.doc2path(otherdoc)))
|
|
||||||
self.data['modules'][mod_name] = pkg_docname
|
self.data['modules'][mod_name] = pkg_docname
|
||||||
|
|
||||||
def find_obj(self, env, mod_name, prefix, name, typ, searchorder=0):
|
def find_obj(self, env, mod_name, prefix, name, typ, searchorder=0):
|
||||||
|
@ -560,17 +560,10 @@ class PyModule(Directive):
|
|||||||
env.ref_context['py:module'] = modname
|
env.ref_context['py:module'] = modname
|
||||||
ret = []
|
ret = []
|
||||||
if not noindex:
|
if not noindex:
|
||||||
modules = env.domaindata['py']['modules']
|
env.domaindata['py']['modules'][modname] = (env.docname,
|
||||||
if modname in modules:
|
self.options.get('synopsis', ''),
|
||||||
self.state_machine.reporter.warning(
|
self.options.get('platform', ''),
|
||||||
'duplicate module description of %s, '
|
'deprecated' in self.options)
|
||||||
'other instance in %s, use :noindex: for one of them' %
|
|
||||||
(modname, env.doc2path(modules[modname][0])),
|
|
||||||
line=self.lineno)
|
|
||||||
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
|
# make a duplicate entry in 'objects' to facilitate searching for
|
||||||
# the module in PythonDomain.find_obj()
|
# the module in PythonDomain.find_obj()
|
||||||
env.domaindata['py']['objects'][modname] = (env.docname, 'module')
|
env.domaindata['py']['objects'][modname] = (env.docname, 'module')
|
||||||
@ -765,21 +758,12 @@ class PythonDomain(Domain):
|
|||||||
|
|
||||||
def merge_domaindata(self, docnames, otherdata):
|
def merge_domaindata(self, docnames, otherdata):
|
||||||
# type: (List[unicode], Dict) -> None
|
# type: (List[unicode], Dict) -> None
|
||||||
|
# XXX check duplicates?
|
||||||
for fullname, (fn, objtype) in otherdata['objects'].items():
|
for fullname, (fn, objtype) in otherdata['objects'].items():
|
||||||
if fn in docnames:
|
if fn in docnames:
|
||||||
if fullname in self.data['objects']:
|
|
||||||
otherdoc, _ = self.data['objects'][fullname]
|
|
||||||
logger.warning('duplicate object description of %s, '
|
|
||||||
'other instance in %s, use :noindex: for one of them' %
|
|
||||||
(fullname, self.env.doc2path(otherdoc)))
|
|
||||||
self.data['objects'][fullname] = (fn, objtype)
|
self.data['objects'][fullname] = (fn, objtype)
|
||||||
for modname, data in otherdata['modules'].items():
|
for modname, data in otherdata['modules'].items():
|
||||||
if data[0] in docnames:
|
if data[0] in docnames:
|
||||||
if modname in self.data['modules']:
|
|
||||||
otherdoc, _, _, _ = self.data['modules'][modname]
|
|
||||||
logger.warning('duplicate module description of %s, '
|
|
||||||
'other instance in %s, use :noindex: for one of them' %
|
|
||||||
(modname, self.env.doc2path(otherdoc)))
|
|
||||||
self.data['modules'][modname] = data
|
self.data['modules'][modname] = data
|
||||||
|
|
||||||
def find_obj(self, env, modname, classname, name, type, searchmode=0):
|
def find_obj(self, env, modname, classname, name, type, searchmode=0):
|
||||||
|
@ -18,7 +18,6 @@ from sphinx.directives import ObjectDescription
|
|||||||
from sphinx.domains import Domain, ObjType
|
from sphinx.domains import Domain, ObjType
|
||||||
from sphinx.locale import l_, _
|
from sphinx.locale import l_, _
|
||||||
from sphinx.roles import XRefRole
|
from sphinx.roles import XRefRole
|
||||||
from sphinx.util import logging
|
|
||||||
from sphinx.util.nodes import make_refnode
|
from sphinx.util.nodes import make_refnode
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
@ -30,7 +29,6 @@ if False:
|
|||||||
from sphinx.environment import BuildEnvironment # NOQA
|
from sphinx.environment import BuildEnvironment # NOQA
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
dir_sig_re = re.compile(r'\.\. (.+?)::(.*)$')
|
dir_sig_re = re.compile(r'\.\. (.+?)::(.*)$')
|
||||||
|
|
||||||
|
|
||||||
@ -141,13 +139,9 @@ class ReSTDomain(Domain):
|
|||||||
|
|
||||||
def merge_domaindata(self, docnames, otherdata):
|
def merge_domaindata(self, docnames, otherdata):
|
||||||
# type: (List[unicode], Dict) -> None
|
# type: (List[unicode], Dict) -> None
|
||||||
|
# XXX check duplicates
|
||||||
for (typ, name), doc in otherdata['objects'].items():
|
for (typ, name), doc in otherdata['objects'].items():
|
||||||
if doc in docnames:
|
if doc in docnames:
|
||||||
if (typ, name) in self.data['objects']:
|
|
||||||
otherdoc = self.data['objects'][typ, name]
|
|
||||||
logger.warning('duplicate description of %s %s, '
|
|
||||||
'other instance in %s' %
|
|
||||||
(typ, name, self.env.doc2path(otherdoc)))
|
|
||||||
self.data['objects'][typ, name] = doc
|
self.data['objects'][typ, name] = doc
|
||||||
|
|
||||||
def resolve_xref(self, env, fromdocname, builder, typ, target, node,
|
def resolve_xref(self, env, fromdocname, builder, typ, target, node,
|
||||||
|
@ -547,6 +547,7 @@ class StandardDomain(Domain):
|
|||||||
|
|
||||||
def merge_domaindata(self, docnames, otherdata):
|
def merge_domaindata(self, docnames, otherdata):
|
||||||
# type: (List[unicode], Dict) -> None
|
# type: (List[unicode], Dict) -> None
|
||||||
|
# XXX duplicates?
|
||||||
for key, data in otherdata['progoptions'].items():
|
for key, data in otherdata['progoptions'].items():
|
||||||
if data[0] in docnames:
|
if data[0] in docnames:
|
||||||
self.data['progoptions'][key] = data
|
self.data['progoptions'][key] = data
|
||||||
@ -555,11 +556,6 @@ class StandardDomain(Domain):
|
|||||||
self.data['objects'][key] = data
|
self.data['objects'][key] = data
|
||||||
for key, data in otherdata['citations'].items():
|
for key, data in otherdata['citations'].items():
|
||||||
if data[0] in docnames:
|
if data[0] in docnames:
|
||||||
if key in self.data['citations']:
|
|
||||||
otherdoc, _, _ = self.data['catations']
|
|
||||||
logger.warning('duplicate citation %s, other instance in %s' %
|
|
||||||
(key, self.env.doc2path(otherdoc)),
|
|
||||||
type='ref', subtype='citation')
|
|
||||||
self.data['citations'][key] = data
|
self.data['citations'][key] = data
|
||||||
for key, data in otherdata['citation_refs'].items():
|
for key, data in otherdata['citation_refs'].items():
|
||||||
citation_refs = self.data['citation_refs'].setdefault(key, [])
|
citation_refs = self.data['citation_refs'].setdefault(key, [])
|
||||||
@ -568,10 +564,6 @@ class StandardDomain(Domain):
|
|||||||
citation_refs.append(docname)
|
citation_refs.append(docname)
|
||||||
for key, data in otherdata['labels'].items():
|
for key, data in otherdata['labels'].items():
|
||||||
if data[0] in docnames:
|
if data[0] in docnames:
|
||||||
if key in self.data['labels']:
|
|
||||||
otherdoc, _, _ = self.data['labels']
|
|
||||||
logger.warning('duplicate label %s, other instance in %s' %
|
|
||||||
(key, self.env.doc2path(otherdoc)))
|
|
||||||
self.data['labels'][key] = data
|
self.data['labels'][key] = data
|
||||||
for key, data in otherdata['anonlabels'].items():
|
for key, data in otherdata['anonlabels'].items():
|
||||||
if data[0] in docnames:
|
if data[0] in docnames:
|
||||||
|
@ -72,10 +72,6 @@ class MathDomain(Domain):
|
|||||||
# type: (Iterable[unicode], Dict) -> None
|
# type: (Iterable[unicode], Dict) -> None
|
||||||
for labelid, (doc, eqno) in otherdata['objects'].items():
|
for labelid, (doc, eqno) in otherdata['objects'].items():
|
||||||
if doc in docnames:
|
if doc in docnames:
|
||||||
if labelid in self.data['objects']:
|
|
||||||
otherdoc, _ = self.data['objects']
|
|
||||||
logger.warning('duplicate label of equation %s, other instance in %s' %
|
|
||||||
(labelid, self.env.doc2path(otherdoc)))
|
|
||||||
self.data['objects'][labelid] = (doc, eqno)
|
self.data['objects'][labelid] = (doc, eqno)
|
||||||
|
|
||||||
def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):
|
def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):
|
||||||
|
Loading…
Reference in New Issue
Block a user