Skip to content

Commit

Permalink
Add and use html_image_rows()
Browse files Browse the repository at this point in the history
  • Loading branch information
kvid committed Jul 20, 2024
1 parent 5156e87 commit 0a1bf0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/wireviz/Harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)],
'<!-- connector table -->' 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))
Expand Down Expand Up @@ -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)],
'<!-- wire table -->',
[html_image(cable.image)],
[html_caption(cable.image)]]
*html_image_rows(connector.image)]
# fmt: on

rows.extend(get_additional_component_table(self, cable))
Expand Down
6 changes: 6 additions & 0 deletions src/wireviz/wv_gv_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0a1bf0f

Please sign in to comment.