makerst: Separate signals/enums/properties/methods with a line
(cherry picked from commit c2e5ef4cec
)
This commit is contained in:
parent
e168f04bc3
commit
1f772917d2
|
@ -425,21 +425,30 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
|
||||||
# Signals
|
# Signals
|
||||||
if len(class_def.signals) > 0:
|
if len(class_def.signals) > 0:
|
||||||
f.write(make_heading('Signals', '-'))
|
f.write(make_heading('Signals', '-'))
|
||||||
|
index = 0
|
||||||
|
|
||||||
for signal in class_def.signals.values():
|
for signal in class_def.signals.values():
|
||||||
#f.write(".. _class_{}_{}:\n\n".format(class_name, signal.name))
|
if index != 0:
|
||||||
|
f.write('----\n\n')
|
||||||
|
|
||||||
f.write(".. _class_{}_signal_{}:\n\n".format(class_name, signal.name))
|
f.write(".. _class_{}_signal_{}:\n\n".format(class_name, signal.name))
|
||||||
_, signature = make_method_signature(class_def, signal, False, state)
|
_, signature = make_method_signature(class_def, signal, False, state)
|
||||||
f.write("- {}\n\n".format(signature))
|
f.write("- {}\n\n".format(signature))
|
||||||
|
|
||||||
if signal.description is None or signal.description.strip() == '':
|
if signal.description is not None and signal.description.strip() != '':
|
||||||
continue
|
f.write(rstize_text(signal.description.strip(), state) + '\n\n')
|
||||||
f.write(rstize_text(signal.description.strip(), state))
|
|
||||||
f.write("\n\n")
|
index += 1
|
||||||
|
|
||||||
# Enums
|
# Enums
|
||||||
if len(class_def.enums) > 0:
|
if len(class_def.enums) > 0:
|
||||||
f.write(make_heading('Enumerations', '-'))
|
f.write(make_heading('Enumerations', '-'))
|
||||||
|
index = 0
|
||||||
|
|
||||||
for e in class_def.enums.values():
|
for e in class_def.enums.values():
|
||||||
|
if index != 0:
|
||||||
|
f.write('----\n\n')
|
||||||
|
|
||||||
f.write(".. _enum_{}_{}:\n\n".format(class_name, e.name))
|
f.write(".. _enum_{}_{}:\n\n".format(class_name, e.name))
|
||||||
# Sphinx seems to divide the bullet list into individual <ul> tags if we weave the labels into it.
|
# Sphinx seems to divide the bullet list into individual <ul> tags if we weave the labels into it.
|
||||||
# As such I'll put them all above the list. Won't be perfect but better than making the list visually broken.
|
# As such I'll put them all above the list. Won't be perfect but better than making the list visually broken.
|
||||||
|
@ -453,8 +462,11 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
|
||||||
f.write("- **{}** = **{}**".format(value.name, value.value))
|
f.write("- **{}** = **{}**".format(value.name, value.value))
|
||||||
if value.text is not None and value.text.strip() != '':
|
if value.text is not None and value.text.strip() != '':
|
||||||
f.write(' --- ' + rstize_text(value.text.strip(), state))
|
f.write(' --- ' + rstize_text(value.text.strip(), state))
|
||||||
|
|
||||||
f.write('\n\n')
|
f.write('\n\n')
|
||||||
|
|
||||||
|
index += 1
|
||||||
|
|
||||||
# Constants
|
# Constants
|
||||||
if len(class_def.constants) > 0:
|
if len(class_def.constants) > 0:
|
||||||
f.write(make_heading('Constants', '-'))
|
f.write(make_heading('Constants', '-'))
|
||||||
|
@ -467,6 +479,7 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
|
||||||
f.write("- **{}** = **{}**".format(constant.name, constant.value))
|
f.write("- **{}** = **{}**".format(constant.name, constant.value))
|
||||||
if constant.text is not None and constant.text.strip() != '':
|
if constant.text is not None and constant.text.strip() != '':
|
||||||
f.write(' --- ' + rstize_text(constant.text.strip(), state))
|
f.write(' --- ' + rstize_text(constant.text.strip(), state))
|
||||||
|
|
||||||
f.write('\n\n')
|
f.write('\n\n')
|
||||||
|
|
||||||
# Class description
|
# Class description
|
||||||
|
@ -484,8 +497,12 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
|
||||||
# Property descriptions
|
# Property descriptions
|
||||||
if len(class_def.properties) > 0:
|
if len(class_def.properties) > 0:
|
||||||
f.write(make_heading('Property Descriptions', '-'))
|
f.write(make_heading('Property Descriptions', '-'))
|
||||||
|
index = 0
|
||||||
|
|
||||||
for property_def in class_def.properties.values():
|
for property_def in class_def.properties.values():
|
||||||
#f.write(".. _class_{}_{}:\n\n".format(class_name, property_def.name))
|
if index != 0:
|
||||||
|
f.write('----\n\n')
|
||||||
|
|
||||||
f.write(".. _class_{}_property_{}:\n\n".format(class_name, property_def.name))
|
f.write(".. _class_{}_property_{}:\n\n".format(class_name, property_def.name))
|
||||||
f.write('- {} **{}**\n\n'.format(property_def.type_name.to_rst(state), property_def.name))
|
f.write('- {} **{}**\n\n'.format(property_def.type_name.to_rst(state), property_def.name))
|
||||||
|
|
||||||
|
@ -499,24 +516,30 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
|
||||||
format_table(f, setget)
|
format_table(f, setget)
|
||||||
|
|
||||||
if property_def.text is not None and property_def.text.strip() != '':
|
if property_def.text is not None and property_def.text.strip() != '':
|
||||||
f.write(rstize_text(property_def.text.strip(), state))
|
f.write(rstize_text(property_def.text.strip(), state) + '\n\n')
|
||||||
f.write('\n\n')
|
|
||||||
|
index += 1
|
||||||
|
|
||||||
# Method descriptions
|
# Method descriptions
|
||||||
if len(class_def.methods) > 0:
|
if len(class_def.methods) > 0:
|
||||||
f.write(make_heading('Method Descriptions', '-'))
|
f.write(make_heading('Method Descriptions', '-'))
|
||||||
|
index = 0
|
||||||
|
|
||||||
for method_list in class_def.methods.values():
|
for method_list in class_def.methods.values():
|
||||||
for i, m in enumerate(method_list):
|
for i, m in enumerate(method_list):
|
||||||
|
if index != 0:
|
||||||
|
f.write('----\n\n')
|
||||||
|
|
||||||
if i == 0:
|
if i == 0:
|
||||||
#f.write(".. _class_{}_{}:\n\n".format(class_name, m.name))
|
|
||||||
f.write(".. _class_{}_method_{}:\n\n".format(class_name, m.name))
|
f.write(".. _class_{}_method_{}:\n\n".format(class_name, m.name))
|
||||||
|
|
||||||
ret_type, signature = make_method_signature(class_def, m, False, state)
|
ret_type, signature = make_method_signature(class_def, m, False, state)
|
||||||
f.write("- {} {}\n\n".format(ret_type, signature))
|
f.write("- {} {}\n\n".format(ret_type, signature))
|
||||||
|
|
||||||
if m.description is None or m.description.strip() == '':
|
if m.description is not None and m.description.strip() != '':
|
||||||
continue
|
f.write(rstize_text(m.description.strip(), state) + '\n\n')
|
||||||
f.write(rstize_text(m.description.strip(), state))
|
|
||||||
f.write("\n\n")
|
index += 1
|
||||||
|
|
||||||
|
|
||||||
def make_class_list(class_list, columns): # type: (List[str], int) -> None
|
def make_class_list(class_list, columns): # type: (List[str], int) -> None
|
||||||
|
|
Loading…
Reference in New Issue