mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merged in jonovik/sphinx (pull request #25)
This commit is contained in:
commit
6ec1cb8e74
@ -168,7 +168,7 @@ class InheritanceGraph(object):
|
|||||||
for cls in classes:
|
for cls in classes:
|
||||||
recurse(cls)
|
recurse(cls)
|
||||||
|
|
||||||
return all_classes.values()
|
return all_classes
|
||||||
|
|
||||||
def class_name(self, cls, parts=0):
|
def class_name(self, cls, parts=0):
|
||||||
"""Given a class object, return a fully-qualified name.
|
"""Given a class object, return a fully-qualified name.
|
||||||
@ -188,7 +188,7 @@ class InheritanceGraph(object):
|
|||||||
|
|
||||||
def get_all_class_names(self):
|
def get_all_class_names(self):
|
||||||
"""Get all of the class names involved in the graph."""
|
"""Get all of the class names involved in the graph."""
|
||||||
return [fullname for (_, fullname, _) in self.class_info]
|
return [fullname for (_, fullname, _) in self.class_info.values()]
|
||||||
|
|
||||||
# These are the default attrs for graphviz
|
# These are the default attrs for graphviz
|
||||||
default_graph_attrs = {
|
default_graph_attrs = {
|
||||||
@ -199,8 +199,8 @@ class InheritanceGraph(object):
|
|||||||
'shape': 'box',
|
'shape': 'box',
|
||||||
'fontsize': 10,
|
'fontsize': 10,
|
||||||
'height': 0.25,
|
'height': 0.25,
|
||||||
'fontname': 'Vera Sans, DejaVu Sans, Liberation Sans, '
|
'fontname': '"Vera Sans, DejaVu Sans, Liberation Sans, '
|
||||||
'Arial, Helvetica, sans',
|
'Arial, Helvetica, sans"',
|
||||||
'style': '"setlinewidth(0.5)"',
|
'style': '"setlinewidth(0.5)"',
|
||||||
}
|
}
|
||||||
default_edge_attrs = {
|
default_edge_attrs = {
|
||||||
@ -241,12 +241,16 @@ class InheritanceGraph(object):
|
|||||||
res.append('digraph %s {\n' % name)
|
res.append('digraph %s {\n' % name)
|
||||||
res.append(self._format_graph_attrs(g_attrs))
|
res.append(self._format_graph_attrs(g_attrs))
|
||||||
|
|
||||||
for name, fullname, bases in self.class_info:
|
for cls, (name, fullname, bases) in self.class_info.items():
|
||||||
# Write the node
|
# Write the node
|
||||||
this_node_attrs = n_attrs.copy()
|
this_node_attrs = n_attrs.copy()
|
||||||
url = urls.get(fullname)
|
if fullname in urls:
|
||||||
if url is not None:
|
this_node_attrs['URL'] = '"%s"' % urls[fullname]
|
||||||
this_node_attrs['URL'] = '"%s"' % url
|
# Use first line of docstring as tooltip, if available
|
||||||
|
if cls.__doc__:
|
||||||
|
doc = cls.__doc__.strip().split("\n")[0]
|
||||||
|
if doc:
|
||||||
|
this_node_attrs['tooltip'] = '"%s"' % doc
|
||||||
res.append(' "%s" [%s];\n' %
|
res.append(' "%s" [%s];\n' %
|
||||||
(name, self._format_node_attrs(this_node_attrs)))
|
(name, self._format_node_attrs(this_node_attrs)))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user