From fa7a8bf9ccd02dbc48e671ed7c661f2523fc002b Mon Sep 17 00:00:00 2001 From: mumesan Date: Wed, 5 Feb 2025 11:43:20 +0000 Subject: [PATCH] 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 --- doc/source/_exts/automated_steps.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/source/_exts/automated_steps.py b/doc/source/_exts/automated_steps.py index 261eab8909..740da1068d 100644 --- a/doc/source/_exts/automated_steps.py +++ b/doc/source/_exts/automated_steps.py @@ -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 = {}