From a905386ee817c4783052604428dc9344d1092240 Mon Sep 17 00:00:00 2001 From: "Kasper D. Fischer" Date: Thu, 3 Apr 2025 14:25:03 +0200 Subject: [PATCH] [bugfix] fixed html output to produce valid html. --- write_utils.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/write_utils.py b/write_utils.py index 626fa8c..dd2c494 100644 --- a/write_utils.py +++ b/write_utils.py @@ -17,7 +17,7 @@ def get_html_text(text): def get_html_header(refresh_rate=10): header = ['', - '', + '', '', ' SurvBot status', ' ', @@ -26,7 +26,7 @@ def get_html_header(refresh_rate=10): ' ', ' ', '', - ''] + '\n'] header = _convert_to_textstring(header) return header @@ -86,8 +86,14 @@ def get_html_row(items, html_key='td'): text_str = get_html_link(text, hyperlink) if hyperlink else text html_class = item.get('html_class') class_str = f' class="{html_class}"' if html_class else '' - row_string += 2 * default_space + f'<{html_key}{class_str} bgcolor="{color}" title="{tooltip}"' \ - + f'style="color:{font_color}">{text_str}\n' + row_string += 2 * default_space + f'<{html_key}{class_str} ' + row_string += f'title="{tooltip}" ' if tooltip else '' + row_string += 'style="' if color or font_color else '' + row_string += f'background-color: {color};' if color else 'style="' + row_string += ' ' if font_color else '' + row_string += f'color: {font_color};' if font_color else '' + row_string += '" ' if color or font_color else '' + row_string += f'>{text_str}\n' row_string += default_space + '\n' return row_string