diff options
| author | Mauro Carvalho Chehab <mchehab@kernel.org> | 2024-03-14 08:28:14 +0100 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2024-03-15 10:18:03 +0100 |
| commit | e0cbbdbcfbf4e7e6f5a6fd528158cfb12351dd41 (patch) | |
| tree | 47969d937afe2d4294c62c3b20b686873aaebac6 /scripts | |
| parent | 6b7d59725980b05df92aa731bd0afe99c4329ba4 (diff) | |
scripts/xls_to_doc.py: preserve line for found fields
By default, the update logic will place new values at the end of
subtests.
Yet, if the field is already at the source file, just update
the value at the line.
Please notice that the logic needs to parse the entire subtest
description, as continuation lines may be present.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Acked-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/xls_to_doc.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/xls_to_doc.py b/scripts/xls_to_doc.py index 0aa774e81..749666faf 100755 --- a/scripts/xls_to_doc.py +++ b/scripts/xls_to_doc.py @@ -155,6 +155,7 @@ class FillTests(TestList): """ current_field = None + found_line = None i = line while True: i += 1 @@ -193,7 +194,7 @@ class FillTests(TestList): current_field = self.field_list[match.group(1).lower()] if current_field != field: continue - content[i] = "" + found_line = i # Handle continuation lines if current_field: @@ -205,6 +206,10 @@ class FillTests(TestList): content[i] = "" if value != "": + if found_line: + content[found_line] = f' * {field}: {value}\n' + return + if i > 2 and re.match(r'\s*\*\s*$', content[i - 1]): i -= 1 |
