mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Reinstate the signature of `InheritanceGraph.generate_dot()
` (#13320)
This commit is contained in:
parent
c4b3dcbaf9
commit
46b6d55467
@ -60,6 +60,7 @@ if TYPE_CHECKING:
|
|||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
from sphinx.application import Sphinx
|
from sphinx.application import Sphinx
|
||||||
from sphinx.config import Config
|
from sphinx.config import Config
|
||||||
|
from sphinx.environment import BuildEnvironment
|
||||||
from sphinx.util.typing import ExtensionMetadata, OptionSpec
|
from sphinx.util.typing import ExtensionMetadata, OptionSpec
|
||||||
from sphinx.writers.html5 import HTML5Translator
|
from sphinx.writers.html5 import HTML5Translator
|
||||||
from sphinx.writers.latex import LaTeXTranslator
|
from sphinx.writers.latex import LaTeXTranslator
|
||||||
@ -307,6 +308,20 @@ class InheritanceGraph:
|
|||||||
return ''.join(f'{k}={v};\n' for k, v in sorted(attrs.items()))
|
return ''.join(f'{k}={v};\n' for k, v in sorted(attrs.items()))
|
||||||
|
|
||||||
def generate_dot(
|
def generate_dot(
|
||||||
|
self,
|
||||||
|
name: str,
|
||||||
|
urls: dict[str, str] | None = None,
|
||||||
|
env: BuildEnvironment | None = None,
|
||||||
|
graph_attrs: dict[str, float | int | str] | None = None,
|
||||||
|
node_attrs: dict[str, float | int | str] | None = None,
|
||||||
|
edge_attrs: dict[str, float | int | str] | None = None,
|
||||||
|
) -> str:
|
||||||
|
config = env.config if env is not None else None
|
||||||
|
return self._generate_dot(
|
||||||
|
name, urls, config, graph_attrs, node_attrs, edge_attrs
|
||||||
|
)
|
||||||
|
|
||||||
|
def _generate_dot(
|
||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
urls: dict[str, str] | None = None,
|
urls: dict[str, str] | None = None,
|
||||||
@ -482,7 +497,7 @@ def html_visit_inheritance_diagram(
|
|||||||
else:
|
else:
|
||||||
urls[child['reftitle']] = '#' + child.get('refid')
|
urls[child['reftitle']] = '#' + child.get('refid')
|
||||||
|
|
||||||
dotcode = graph.generate_dot(name, urls, config=self.config)
|
dotcode = graph._generate_dot(name, urls, config=self.config)
|
||||||
render_dot_html(
|
render_dot_html(
|
||||||
self,
|
self,
|
||||||
node,
|
node,
|
||||||
@ -504,7 +519,7 @@ def latex_visit_inheritance_diagram(
|
|||||||
graph_hash = get_graph_hash(node)
|
graph_hash = get_graph_hash(node)
|
||||||
name = 'inheritance%s' % graph_hash
|
name = 'inheritance%s' % graph_hash
|
||||||
|
|
||||||
dotcode = graph.generate_dot(
|
dotcode = graph._generate_dot(
|
||||||
name, config=self.config, graph_attrs={'size': '"6.0,6.0"'}
|
name, config=self.config, graph_attrs={'size': '"6.0,6.0"'}
|
||||||
)
|
)
|
||||||
render_dot_latex(self, node, dotcode, {}, 'inheritance')
|
render_dot_latex(self, node, dotcode, {}, 'inheritance')
|
||||||
@ -521,7 +536,7 @@ def texinfo_visit_inheritance_diagram(
|
|||||||
graph_hash = get_graph_hash(node)
|
graph_hash = get_graph_hash(node)
|
||||||
name = 'inheritance%s' % graph_hash
|
name = 'inheritance%s' % graph_hash
|
||||||
|
|
||||||
dotcode = graph.generate_dot(
|
dotcode = graph._generate_dot(
|
||||||
name, config=self.config, graph_attrs={'size': '"6.0,6.0"'}
|
name, config=self.config, graph_attrs={'size': '"6.0,6.0"'}
|
||||||
)
|
)
|
||||||
render_dot_texinfo(self, node, dotcode, {}, 'inheritance')
|
render_dot_texinfo(self, node, dotcode, {}, 'inheritance')
|
||||||
|
Loading…
Reference in New Issue
Block a user