diff options
| author | Georg Brandl <georg@python.org> | 2008-12-25 22:06:10 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2008-12-25 22:06:10 +0100 |
| commit | f0cc764b6073a0e82264d155099023fd010e313a (patch) | |
| tree | b0df83f56b6f248430131ff682e1fc66552a0603 /sphinx/addnodes.py | |
| parent | fca6a2e59767a66110e1c66b67e29cc268f062ad (diff) | |
| download | sphinx-f0cc764b6073a0e82264d155099023fd010e313a.tar.gz | |
Change the way to handle return annotations a bit.
Diffstat (limited to 'sphinx/addnodes.py')
| -rw-r--r-- | sphinx/addnodes.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sphinx/addnodes.py b/sphinx/addnodes.py index 8b20f7ac..ad4909e0 100644 --- a/sphinx/addnodes.py +++ b/sphinx/addnodes.py @@ -23,8 +23,12 @@ class desc(nodes.Admonition, nodes.Element): pass class desc_addname(nodes.Part, nodes.Inline, nodes.TextElement): pass # compatibility alias desc_classname = desc_addname -# return type (C); object type, e.g. -> annotation (Python) +# return type (C); object type class desc_type(nodes.Part, nodes.Inline, nodes.TextElement): pass +# -> annotation (Python) +class desc_returns(desc_type): + def astext(self): + return ' -> ' + nodes.TextElement.astext(self) # main name of object class desc_name(nodes.Part, nodes.Inline, nodes.TextElement): pass # argument list @@ -90,7 +94,8 @@ class meta(nodes.Special, nodes.PreBibliographic, nodes.Element): pass # make them known to docutils. this is needed, because the HTML writer # will choke at some point if these are not added -nodes._add_node_class_names("""index desc desc_content desc_signature desc_type +nodes._add_node_class_names("""index desc desc_content desc_signature + desc_type desc_returns desc_addname desc_name desc_parameterlist desc_parameter desc_optional centered versionmodified seealso productionlist production toctree pending_xref compact_paragraph highlightlang literal_emphasis |
