From 0a1bf0f3fd40cc9919947867c370007bb7b1deae Mon Sep 17 00:00:00 2001 From: KV Date: Fri, 19 Jul 2024 19:07:28 +0200 Subject: [PATCH] Add and use html_image_rows() --- src/wireviz/Harness.py | 9 +++------ src/wireviz/wv_gv_html.py | 6 ++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index c4af2364..e32edf57 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -34,9 +34,8 @@ from wireviz.wv_gv_html import ( html_bgcolor, html_bgcolor_attr, - html_caption, html_colorbar, - html_image, + html_image_rows, html_line_breaks, nested_html_table, remove_links, @@ -203,8 +202,7 @@ def create_graph(self) -> Graph: translate_color(connector.color, self.options.color_mode) if connector.color else None, html_colorbar(connector.color)], '' if connector.style != 'simple' else None, - [html_image(connector.image)], - [html_caption(connector.image)]] + *html_image_rows(connector.image)] # fmt: on rows.extend(get_additional_component_table(self, connector)) @@ -326,8 +324,7 @@ def create_graph(self) -> Graph: translate_color(cable.color, self.options.color_mode) if cable.color else None, html_colorbar(cable.color)], '', - [html_image(cable.image)], - [html_caption(cable.image)]] + *html_image_rows(connector.image)] # fmt: on rows.extend(get_additional_component_table(self, cable)) diff --git a/src/wireviz/wv_gv_html.py b/src/wireviz/wv_gv_html.py index ec80aa74..574bd2d1 100644 --- a/src/wireviz/wv_gv_html.py +++ b/src/wireviz/wv_gv_html.py @@ -64,6 +64,12 @@ def html_colorbar(color: Color) -> str: return html_bgcolor(color, ' width="4"') if color else None +def html_image_rows(image): + from wireviz.wv_bom import make_list + + return sum([[[html_image(i)], [html_caption(i)]] for i in make_list(image)], []) + + def html_image(image): from wireviz.DataClasses import Image