diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index b729d0a..a8379f7 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -7,9 +7,8 @@ from wireviz import wv_colors, wv_helper, __version__, APP_NAME, APP_URL from wireviz.wv_colors import get_color_hex from wireviz.wv_helper import awg_equiv, mm2_equiv, tuplelist2tsv, \ nested_html_table, flatten2d, index_if_list, html_line_breaks, \ - graphviz_line_breaks, remove_line_breaks, clean_whitespace, open_file_read, \ - open_file_write, html_colorbar, html_image, html_caption, \ - manufacturer_info_field, component_table_entry + clean_whitespace, open_file_read, open_file_write, html_colorbar, \ + html_image, html_caption, manufacturer_info_field, component_table_entry from collections import Counter from typing import List, Union from pathlib import Path @@ -451,7 +450,7 @@ class Harness: # Remove linebreaks and clean whitespace of values in search target = tuple(clean_whitespace(v) for v in (item, unit, manufacturer, mpn, pn)) for entry in self.bom(): - if(entry['item'], entry['unit'], entry['manufacturer'], entry['mpn'], entry['pn']) == target: + if (entry['item'], entry['unit'], entry['manufacturer'], entry['mpn'], entry['pn']) == target: return entry['id'] return None diff --git a/src/wireviz/wv_helper.py b/src/wireviz/wv_helper.py index 57e7a61..79722bd 100644 --- a/src/wireviz/wv_helper.py +++ b/src/wireviz/wv_helper.py @@ -146,12 +146,6 @@ def index_if_list(value, index): def html_line_breaks(inp): return inp.replace('\n', '
') if isinstance(inp, str) else inp -def graphviz_line_breaks(inp): - return inp.replace('\n', '\\n') if isinstance(inp, str) else inp # \n generates centered new lines. http://www.graphviz.org/doc/info/attrs.html#k:escString - -def remove_line_breaks(inp): - return inp.replace('\n', ' ').strip() if isinstance(inp, str) else inp - def clean_whitespace(inp): return ' '.join(inp.split()).replace(' ,', ',') if isinstance(inp, str) else inp @@ -202,4 +196,7 @@ def component_table_entry(type, qty, unit=None, pn=None, manufacturer=None, mpn= output += manufacturer_str output = html_line_breaks(output) # format the above output as left aligned text in a single visible cell - return f'
{output}
' + # indent is set to two to match the indent in the generated html table + return f''' + +
{output}
'''