sphinx_uml.uml_generate_directive module#
- class sphinx_uml.uml_generate_directive.UMLGenerateDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]#
Bases:
SphinxDirectiveUML directive to generate a pyreverse diagram
- final_argument_whitespace = True#
May the final argument contain whitespace?
- has_content = False#
May the directive have content?
- html_root_dir() Path[source]#
Crafts the HTML prefix to move from the current HTML to the HTML root directory.
- Returns:
The corresponding relative
Pathinstance.
Example
Assume that:
the documentation is built in:
"~/git/sphinx-uml/docs";the current document is;
"~/git/sphinx-uml/docs/users/examples.rst";
Then, the returned value is
"../". As the HTML hierarchy follows the RST hierarchy, we use this prefix to setup ourSphinxHtmlProxy.
- option_spec: ClassVar[dict[str, Callable[[str], Any]]] = {'caption': <function unchanged>, 'classes': <function flag>, 'packages': <function flag>}#
Mapping of option names to validator functions.
- optional_arguments = 0#
Number of optional arguments after the required arguments.
- required_arguments = 1#
Number of required directive arguments.
- class sphinx_uml.uml_generate_directive.UmlNode(rawsource='', *children, **attributes)[source]#
Bases:
graphvizDefines a UML
docutilsnode. We populate its attribute so that we can rely on the defaultgraphviznode.- classmethod from_dot(dotcode: str) UmlNode[source]#
Builds a
UmlNodeinstance from a Graphviz dot string.- Parameters:
dotcode (str) – A Graphviz dot string. Example:
digraph G {0 -> 1}- Returns:
The resulting
UmlNodeinstance.
- classmethod from_pyreverse(diagram: ClassDiagram | PackageDiagram, config: Namespace) UmlNode[source]#
Builds a
UmlNodefrom a diagram definition obtained frompyreverse.- Parameters:
diagram (ClassDiagram | PackageDiagram) – The diagram that must be exported.
config (argparse.Namespace) – The configuration obtained from the Sphinx configuration file.
- Returns:
The resulting
UmlNodeinstance.
- classmethod to_dot(diagram: ClassDiagram | PackageDiagram, config: Namespace) str[source]#
Exports a diagram definition obtained from
pyreverseto a Graphviz dot string.- Parameters:
diagram (ClassDiagram | PackageDiagram) – The diagram that must be exported.
config (argparse.Namespace) – The configuration obtained from the Sphinx configuration file.
- Returns:
The resulting
UmlNodeinstance.
- sphinx_uml.uml_generate_directive.guess_svg_basename(options: dict, code: str) str[source]#
Infers the svg filename of an UML diagram See
/usr/lib/python3/dist-packages/sphinx/ext/graphviz.py.- Parameters:
options (dict) – The options passed to the
graphviz.ext.render_dot()function.code (str) – A graphviz string, passed to the
graphviz.ext.render_dot()function.
- Returns:
The corresponding SVG basename