sphinx support for documenting multiple return values

This commit is contained in:
2010-01-02 18:55:07 +00:00
parent 78b2eb8d3c
commit cef8b2088f
2 changed files with 20 additions and 8 deletions

View File

@@ -115,8 +115,8 @@ def rna2sphinx(BASEPATH):
#if not struct.identifier.startswith("Sc") and not struct.identifier.startswith("I"):
# return
#if not struct.identifier.startswith("Bone"):
# return
if not struct.identifier == "Object":
return
filepath = os.path.join(BASEPATH, "bpy.types.%s.rst" % struct.identifier)
file = open(filepath, "w")
@@ -182,8 +182,17 @@ def rna2sphinx(BASEPATH):
for prop in func.args:
write_param(" ", fw, prop)
if func.return_value:
write_param(" ", fw, func.return_value, is_return=True)
if len(func.return_values) == 1:
write_param(" ", fw, func.return_values[0], is_return=True)
else: # multiple return values
fw(" :return (%s):\n" % ", ".join([prop.identifier for prop in func.return_values]))
for prop in func.return_values:
type_descr = prop.get_type_description(as_arg=True, class_fmt=":class:`%s`")
descr = prop.description
if not descr:
descr = prop.name
fw(" `%s`, %s, %s\n\n" % (prop.identifier, descr, type_descr))
fw("\n")