""" Script to generate the OBUS catalog from JSON files. """ import json if __name__ == "__main__": with open('controllers.json') as controllers: controllers = json.load(controllers) for controller in controllers.keys(): # Make the section and title res = f'
\n

{controller}

\n' controller_config = controllers[controller] # Add the controller image and containers res += '
\n
\n
\n
\n' res += f'\n
\n
\n

{controller}

\n
\n' # Add features res += '
\n
Features
\n
    \n' for feat in controller_config['features']: res += f'
  • {feat}
  • \n' # Add descriptions res += '
\n
Description
\n' res += f'

{controller_config["description"]}

\n' # Add applications res += '
Applications
\n
    \n' for appl in controller_config['applications']: res += f'
  • {appl}
  • \n' res += '
\n
\n
\n' # Add electrical specs res += '
\n

electrical specs

\n
\n' res += '\n\n\n\n\n' res += '\n\n\n\n\n' for spec in controller_config['el-specs'].keys(): res += f'\n\n' specs = controller_config['el-specs'][spec] res += f'\n\n\n\n\n' # Add application note res += '
CharacteristicLimitsunit
mintypmax
{spec}{specs["min"]}{specs["typ"]}{specs["max"]}{specs["unit"]}
\n
\n

Application note

\n' res += f'

{controller_config["app-note"]}

\n
\n' # Add document links res += '
\n

documents

\n\n
\n' # Add order codes res += '
\n

order codes

\n
\n\n' res+='\n\n\n\n' for code, desc in controller_config['order-codes'].items(): res += f'\n\n\n\n' res += '
Descriptioncode
{desc}{code}
\n
\n
\n' # Add clsing tag res += '
' print(res) # with open(controller+'.html', 'w') as out: # out.write(res)