diff --git a/src/wireviz/wv_gv_html.py b/src/wireviz/wv_gv_html.py
index c252398..9927501 100644
--- a/src/wireviz/wv_gv_html.py
+++ b/src/wireviz/wv_gv_html.py
@@ -116,6 +116,21 @@ def gv_node_component(
return tbl
+def make_list_of_cells(inp) -> List[Td]:
+ # inp may be List,
+ if isinstance(inp, List):
+ # ensure all list items are Td
+ list_out = [item if isinstance(item, Td) else Td(item) for item in inp]
+ return list_out
+ else:
+ if inp is None:
+ return []
+ if isinstance(inp, Td):
+ return [inp]
+ else:
+ return [Td(inp)]
+
+
def nested_table(cell_lists: List[Td]) -> Table:
outer_table_attribs = {
"border": 0,
@@ -156,21 +171,6 @@ def nested_table(cell_lists: List[Td]) -> Table:
return tbl
-def make_list_of_cells(inp) -> List[Td]:
- # inp may be List,
- if isinstance(inp, List):
- # ensure all list items are Td
- list_out = [item if isinstance(item, Td) else Td(item) for item in inp]
- return list_out
- else:
- if inp is None:
- return []
- if isinstance(inp, Td):
- return [inp]
- else:
- return [Td(inp)]
-
-
def gv_pin_row(pin_index, pin_name, pin_label, pin_color, connector):
cell_pin_left = Td(pin_name, attribs={"port": f"p{pin_index+1}l"})
cell_pin_label = Td(pin_label, empty_is_none=True)
@@ -276,6 +276,18 @@ def colored_cell(contents, bgcolor) -> Td:
return Td(contents, attribs=attribs)
+def part_number_str_list(component: Component) -> List[str]:
+ cell_contents = [
+ pn_info_string(HEADER_PN, None, component.pn),
+ pn_info_string(HEADER_MPN, component.manufacturer, component.mpn),
+ pn_info_string(HEADER_SPN, component.supplier, component.spn),
+ ]
+ if any(cell_contents):
+ return [html_line_breaks(cell) for cell in cell_contents]
+ else:
+ return None
+
+
def colorbar_cell(color) -> Td:
if color:
colorbar_attribs = {
@@ -287,15 +299,6 @@ def colorbar_cell(color) -> Td:
return None
-# def html_image_new(image):
-# from wireviz.DataClasses import Image
-# if not image:
-# return None
-# image_tag = Img(attribs={"scale": image.scale, "src": image.src})
-# image_table = Table(Tr(Td(image_tag, attribs=html_size_attr_dict(image))), attribs={"border": 0, "cellspacing": 0, "cellborder": 0})
-# return image_table
-
-
def image_and_caption_cells(component: Component) -> (Td, Td):
if not component.image:
return (None, None)
@@ -326,65 +329,15 @@ def image_and_caption_cells(component: Component) -> (Td, Td):
image_cell.attribs = Attribs(outer_cell_attribs)
if component.image.caption:
- caption_cell_attribs = {"balign": "left", "sides": "BLR", "id": "td_caption"}
caption_cell = Td(
- html_caption_new(component.image), attribs=caption_cell_attribs
+ f"{html_line_breaks(component.image.caption)}",
+ attribs={"balign": "left", "sides": "BLR", "id": "td_caption"},
)
else:
caption_cell = None
return (image_cell, caption_cell)
-def part_number_str_list(component: Component) -> List[str]:
- cell_contents = [
- pn_info_string(HEADER_PN, None, component.pn),
- pn_info_string(HEADER_MPN, component.manufacturer, component.mpn),
- pn_info_string(HEADER_SPN, component.supplier, component.spn),
- ]
- if any(cell_contents):
- return [html_line_breaks(cell) for cell in cell_contents]
- else:
- return None
-
-
-# def html_image(image):
-# from wireviz.DataClasses import Image
-# if not image:
-# return None
-# # The leading attributes belong to the preceeding tag. See where used below.
-# html = f'{html_size_attr(image)}>'
-# if image.fixedsize:
-# # Close the preceeding tag and enclose the image cell in a table without
-# # borders to avoid narrow borders when the fixed width < the node width.
-# html = f""">
-#
| -# |