"""
Script to generate the OBUS catalog from JSON files.
"""
import json
def catalog_json_item_to_html(name: str, config: dict) -> str:
# Make the section and title
res = f' {config["description"]} {config["app-note"]}{name}
\n'
# Add the item image and containers
res += 'Features
\n\n'
for feat in config['features']:
res += f'
\nDescription
\n'
res += f'Applications
\n\n'
for appl in config['applications']:
res += f'
\nelectrical specs
\n'
res += '
\n\n \n'
res += 'Characteristic \nLimits \nunit \n\n \n'
for spec in config['el-specs'].keys():
res += f'min \ntyp \nmax \n\n \n'
# Add application note
res += '{spec} \n'
specs = config['el-specs'][spec]
res += f'{specs["min"]} \n{specs["typ"]} \n{specs["max"]} \n{specs["unit"]} \nApplication note
\n'
res += f'documents
\n\n'
for doctype, doclink in config['documents'].items():
res += f'
\norder codes
\n\n'
res += '
\n\n \n'
for code, desc in config['order-codes'].items():
res += f'Description \ncode \n\n \n'
res += '{desc} \n{code} \n
O.B.U.S. Catalog
\n' catalog += 'August 2020
\n