diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py
index bbd1034..394640a 100644
--- a/src/wireviz/Harness.py
+++ b/src/wireviz/Harness.py
@@ -4,7 +4,7 @@
from wireviz.DataClasses import Connector, Cable
from graphviz import Graph
from wireviz import wv_colors
-from wireviz.wv_helper import awg_equiv, mm2_equiv, tuplelist2tsv, nested, flatten2d, index_if_list, html_line_breaks, graphviz_line_breaks, remove_line_breaks
+from wireviz.wv_helper import awg_equiv, mm2_equiv, tuplelist2tsv, nested, nested_html_table, flatten2d, index_if_list, html_line_breaks, graphviz_line_breaks, remove_line_breaks
from collections import Counter
from typing import List
@@ -67,14 +67,7 @@ class Harness:
[html_line_breaks(connector.notes)]]
rows = [list(filter(None, row)) for row in rows] # remove missing attributes
- html = '
'
- for row in rows:
- if len(row) > 0:
- html = f'{html}'
- for cell in row:
- html = f'{html}| {cell} | '
- html = f'{html}
|
'
- html = f'{html}
'
+ html = nested_html_table(rows)
if connector.color: # add color bar next to color info, if present
colorbar = f' bgcolor="{wv_colors.translate_color(connector.color, "HEX")}" width="4">' # leave out ' tag
diff --git a/src/wireviz/wv_helper.py b/src/wireviz/wv_helper.py
index f5293ec..83ee46e 100644
--- a/src/wireviz/wv_helper.py
+++ b/src/wireviz/wv_helper.py
@@ -44,6 +44,20 @@ def nested(inp):
l.append(str(x))
return '|'.join(l)
+def nested_html_table(rows):
+ # input: list of lists
+ # output: a parent table with one child table per parent list item
+ # purpose: create the appearance of one table, where cell widths are independent between rows
+ html = ''
+ for row in rows:
+ if len(row) > 0:
+ html = f'{html}'
+ for cell in row:
+ html = f'{html}| {cell} | '
+ html = f'{html}
| '
+ html = f'{html} '
+ return html
+
def int2tuple(inp):
if isinstance(inp, tuple):
|