From aa9278da4bb5bd80cf8b1254bb0d430ba01c2d97 Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Sat, 2 Oct 2021 18:07:25 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: kvid --- src/wireviz/wv_html.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/wireviz/wv_html.py b/src/wireviz/wv_html.py index 7721dd4..ee8a4e0 100644 --- a/src/wireviz/wv_html.py +++ b/src/wireviz/wv_html.py @@ -24,11 +24,10 @@ def generate_html_output(filename: Union[str, Path], bom_list: List[List[str]], # embed SVG diagram with open_file_read(f'{filename}.svg') as file: - svgdata = file.read() svgdata = re.sub( - '^<[?]xml [^?>]*[?]>[^<]*]*>', - '', - svgdata, 1) + '^<[?]xml [^?>]*[?]>[^<]*]*>', + '', + file.read(), 1) # generate BOM table bom = flatten2d(bom_list) @@ -57,7 +56,7 @@ def generate_html_output(filename: Union[str, Path], bom_list: List[List[str]], replacements = { '': f'{APP_NAME} {__version__} - {APP_URL}', '': options.fontname, - '': options.bgcolor, # TODO: currently not working, requires translation from 2-char color code to HTML + '': wv_colors.translate_color(options.bgcolor, "hex"), '': svgdata, '': bom_html, '': bom_html_reversed,