sphinx support for documenting multiple return values
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user