summaryrefslogtreecommitdiff
path: root/sphinx/addnodes.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-12-25 22:06:10 +0100
committerGeorg Brandl <georg@python.org>2008-12-25 22:06:10 +0100
commitf0cc764b6073a0e82264d155099023fd010e313a (patch)
treeb0df83f56b6f248430131ff682e1fc66552a0603 /sphinx/addnodes.py
parentfca6a2e59767a66110e1c66b67e29cc268f062ad (diff)
downloadsphinx-f0cc764b6073a0e82264d155099023fd010e313a.tar.gz
Change the way to handle return annotations a bit.
Diffstat (limited to 'sphinx/addnodes.py')
-rw-r--r--sphinx/addnodes.py9
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