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:
@@ -62,11 +62,14 @@ def _list_table(add, headers, data, title='', columns=None):
|
|||||||
def _format_doc(doc):
|
def _format_doc(doc):
|
||||||
"Format one method docstring to be shown in the step table."
|
"Format one method docstring to be shown in the step table."
|
||||||
paras = doc.split('\n\n')
|
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
|
# Remove the field table that commonly appears at the end of a
|
||||||
# docstring.
|
# docstring.
|
||||||
paras = paras[:-1]
|
formatted_docstring.append(line)
|
||||||
return '\n\n'.join(paras)
|
return '\n\n'.join(formatted_docstring)
|
||||||
|
|
||||||
|
|
||||||
_clean_steps = {}
|
_clean_steps = {}
|
||||||
|
Reference in New Issue
Block a user