Allow line breaks in generic metadata
This commit is contained in:
parent
1a41faf187
commit
f424ea541e
@ -61,7 +61,7 @@ def generate_html_output(filename: Union[str, Path], bom_list: List[List[str]],
|
|||||||
|
|
||||||
# insert generator
|
# insert generator
|
||||||
html = html.replace('<!-- %generator% -->', f'{APP_NAME} {__version__} - {APP_URL}')
|
html = html.replace('<!-- %generator% -->', f'{APP_NAME} {__version__} - {APP_URL}')
|
||||||
|
|
||||||
# insert other metadata
|
# insert other metadata
|
||||||
if metadata:
|
if metadata:
|
||||||
|
|
||||||
@ -74,13 +74,13 @@ def generate_html_output(filename: Union[str, Path], bom_list: List[List[str]],
|
|||||||
# fill out other generic metadata
|
# fill out other generic metadata
|
||||||
for item, contents in metadata.items():
|
for item, contents in metadata.items():
|
||||||
if isinstance(contents, (str, int, float)):
|
if isinstance(contents, (str, int, float)):
|
||||||
html = html.replace(f'<!-- %{item}% -->', contents)
|
html = html.replace(f'<!-- %{item}% -->', html_line_breaks(contents))
|
||||||
elif isinstance(contents, Dict): # useful for authors, revisions
|
elif isinstance(contents, Dict): # useful for authors, revisions
|
||||||
for index, (category, entry) in enumerate(contents.items()):
|
for index, (category, entry) in enumerate(contents.items()):
|
||||||
if isinstance(entry, Dict):
|
if isinstance(entry, Dict):
|
||||||
html = html.replace(f'<!-- %{item}_{index+1}% -->', str(category))
|
html = html.replace(f'<!-- %{item}_{index+1}% -->', str(category))
|
||||||
for entry_key, entry_value in entry.items():
|
for entry_key, entry_value in entry.items():
|
||||||
html = html.replace(f'<!-- %{item}_{index+1}_{entry_key}% -->', str(entry_value))
|
html = html.replace(f'<!-- %{item}_{index+1}_{entry_key}% -->', html_line_breaks(str(entry_value)))
|
||||||
|
|
||||||
|
|
||||||
with open(f'{filename}.html','w') as file:
|
with open(f'{filename}.html','w') as file:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user