diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-10-28 18:21:53 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-10-28 18:21:53 -0400 |
| commit | 94323a776025311dde041533e6cb2f57d4ed509b (patch) | |
| tree | e63924e99dbbdaf268f6365535a397780e660925 | |
| parent | 47da8e06da5067b87f1342d0f781696e790e9005 (diff) | |
| download | sqlalchemy-94323a776025311dde041533e6cb2f57d4ed509b.tar.gz | |
- add a missing reference handler to handle the inheriting names that aren't in the docs
| -rw-r--r-- | doc/build/builder/autodoc_mods.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/doc/build/builder/autodoc_mods.py b/doc/build/builder/autodoc_mods.py index 8c687fb3a..576b4c339 100644 --- a/doc/build/builder/autodoc_mods.py +++ b/doc/build/builder/autodoc_mods.py @@ -12,6 +12,7 @@ def autodoc_skip_member(app, what, name, obj, skip, options): # im sure this is in the app somewhere, but I don't really # know where, so we're doing it here. _track_autodoced = {} +_inherited_names = set() def autodoc_process_docstring(app, what, name, obj, options, lines): if what == "class": _track_autodoced[name] = obj @@ -26,22 +27,33 @@ def autodoc_process_docstring(app, what, name, obj, options, lines): if attrname in supercls.__dict__: break if supercls is not cls: + _inherited_names.add("%s.%s" % (supercls.__module__, supercls.__name__)) + _inherited_names.add("%s.%s.%s" % (supercls.__module__, supercls.__name__, attrname)) lines[:0] = [ ".. container:: inherited_member", "", - " *inherited from the* :%s:`.%s.%s` *%s of* :class:`.%s`" % ( + " *inherited from the* :%s:`~%s.%s.%s` *%s of* :class:`~%s.%s`" % ( "attr" if what == "attribute" else "meth", - supercls.__name__, + supercls.__module__, supercls.__name__, attrname, what, - supercls.__name__ + supercls.__module__, supercls.__name__ ), "" ] +from docutils import nodes +def missing_reference(app, env, node, contnode): + if node.attributes['reftarget'] in _inherited_names: + return node.children[0] + else: + return None + + def setup(app): app.connect('autodoc-skip-member', autodoc_skip_member) app.connect('autodoc-process-docstring', autodoc_process_docstring) + app.connect('missing-reference', missing_reference) |
