from .logger import logger def image(src): return f'' def video(src): return f'' def short_desc(desc): return f'{desc}' descriptions = { } sizes = ['1.4','1.2','1'] def as_html(entry, depth=0): if isinstance(entry, dict): size = 0.8 if depth < 2 else 1 html = '' for k in entry: if k == "collapsed": continue collapse_single = k.endswith("_collapsed") if collapse_single: name = k[:-len("_collapsed")] else: name = k collapse_flag = ' VHS_precollapse' if entry.get("collapsed", False) or collapse_single else '' html += f'[-]{name}: {as_html(entry[k], depth=depth+1)}' return html if isinstance(entry, list): html = '' for i in entry: html += f'{as_html(i, depth=depth)}' return html return str(entry) def format_descriptions(nodes): for k in descriptions: if k.endswith("_collapsed"): k = k[:-len("_collapsed")] nodes[k].DESCRIPTION = as_html(descriptions[k]) # undocumented_nodes = [] # for k in nodes: # if not hasattr(nodes[k], "DESCRIPTION"): # undocumented_nodes.append(k) # if len(undocumented_nodes) > 0: # logger.info(f"Undocumented nodes: {undocumented_nodes}")