diff --git a/src/wireviz/wv_helper.py b/src/wireviz/wv_helper.py index 8992ba5..8b31815 100644 --- a/src/wireviz/wv_helper.py +++ b/src/wireviz/wv_helper.py @@ -58,8 +58,18 @@ def nested_html_table(rows): def html_image(node): if not node.image: return None - return f'''''' \ - f'''''' + size = html_size_attr(node.image_size) + # The leading attributes belong to the preceeding tag. See where used below. + html = f'{"".join(size)}>' + if size[2]: # 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'''> + + +
+ ''' + return f'''{html_line_breaks(node.caption)}''' if node.caption else None @@ -69,10 +79,13 @@ def html_size_attr(size): # size: List of values where only these are used: # - First value is minimum width of object in points, an int value in the range 1-65535. (Default 0 = none) # - Second value is minimum height of the object in points, an int value in the range 1-65535. (Default 0 = none) + # - Third value is a boolean where TRUE specify that the first two values are the fixed image cell size. + # (Default FALSE) Other string values, e.g. FIXED are also interpreted as TRUE. if not size or not isinstance(size, list): - return '' - return ((f' width="{size[0]}"' if len(size) > 0 and size[0] else '') - + (f' height="{size[1]}"' if len(size) > 1 and size[1] else '')) + return [''] * 3 + return [f' width="{size[0]}"' if len(size) > 0 and size[0] else '', + f' height="{size[1]}"' if len(size) > 1 and size[1] else '', + ' fixedsize="TRUE"' if len(size) > 2 and size[2] else ''] def expand(yaml_data):