Fixes upstream table width on cleaning docs

The _format_doc function filters out fields from the docstring when generating Sphinx documentation but does not account for a case where there may be blank lines between fields. As a result, only the last group of fields may be filtered out. This fix filters out all lines which are fields.

Closes-Bug: #2097310
Change-Id: I7e702b82b4d2ce20520479d8a8210be36bfbdd5e
This commit is contained in:
mumesan 2025-02-05 11:43:20 +00:00
parent eeed59435c
commit fa7a8bf9cc

View File

@ -62,11 +62,14 @@ def _list_table(add, headers, data, title='', columns=None):
def _format_doc(doc):
"Format one method docstring to be shown in the step table."
paras = doc.split('\n\n')
if paras[-1].startswith(':'):
formatted_docstring = []
for line in paras:
if line.startswith(':'):
continue
# Remove the field table that commonly appears at the end of a
# docstring.
paras = paras[:-1]
return '\n\n'.join(paras)
formatted_docstring.append(line)
return '\n\n'.join(formatted_docstring)
_clean_steps = {}