diff options
Diffstat (limited to 'doc/usage/extensions/inheritance.rst')
-rw-r--r-- | doc/usage/extensions/inheritance.rst | 53 |
1 files changed, 47 insertions, 6 deletions
diff --git a/doc/usage/extensions/inheritance.rst b/doc/usage/extensions/inheritance.rst index c66f4130f..8e98b0bc1 100644 --- a/doc/usage/extensions/inheritance.rst +++ b/doc/usage/extensions/inheritance.rst @@ -25,12 +25,18 @@ It adds this directive: graph. This directive supports an option called ``parts`` that, if given, must be an - integer, advising the directive to remove that many parts of module names - from the displayed names. (For example, if all your class names start with - ``lib.``, you can give ``:parts: 1`` to remove that prefix from the displayed - node names.) - - It also supports a ``private-bases`` flag option; if given, private base + integer, advising the directive to keep that many dot-separated parts + in the displayed names (from right to left). For example, ``parts=1`` will + only display class names, without the names of the modules that contain + them. + + .. versionchanged:: 2.0 + The value of for ``parts`` can also be negative, indicating how many + parts to drop from the left. For example, if all your class names start + with ``lib.``, you can give ``:parts: -1`` to remove that prefix from the + displayed node names. + + The directive also supports a ``private-bases`` flag option; if given, private base classes (those whose name starts with ``_``) will be included. You can use ``caption`` option to give a caption to the diagram. @@ -92,6 +98,41 @@ It adds this directive: Added ``top-classes`` option to limit the scope of inheritance graphs. +Examples +-------- + +The following are different inheritance diagrams for the internal +``InheritanceDiagram`` class that implements the directive. + +With full names:: + + .. inheritance-diagram:: sphinx.ext.inheritance_diagram.InheritanceDiagram + +.. inheritance-diagram:: sphinx.ext.inheritance_diagram.InheritanceDiagram + + +Showing class names only:: + + .. inheritance-diagram:: sphinx.ext.inheritance_diagram.InheritanceDiagram + :parts: 1 + +.. inheritance-diagram:: sphinx.ext.inheritance_diagram.InheritanceDiagram + :parts: 1 + +Stopping the diagram at :class:`sphinx.util.docutils.SphinxDirective` (the +highest superclass still part of Sphinx), and dropping the common left-most +part (``sphinx``) from all names:: + + .. inheritance-diagram:: sphinx.ext.inheritance_diagram.InheritanceDiagram + :top-classes: sphinx.util.docutils.SphinxDirective + :parts: -1 + +.. inheritance-diagram:: sphinx.ext.inheritance_diagram.InheritanceDiagram + :top-classes: sphinx.util.docutils.SphinxDirective + :parts: -1 + + + Configuration ------------- |