Convert a VDOM dictionary into an HTML string Only the following keys are translated to HTML: - ``tagName`` - ``attributes`` - ``children`` (must be strings or more VDOM dicts) Parameters: vdom: The VdomDict element to convert to HTML
(vdom: VdomDict)
| 60 | |
| 61 | |
| 62 | def vdom_to_html(vdom: VdomDict) -> str: |
| 63 | """Convert a VDOM dictionary into an HTML string |
| 64 | |
| 65 | Only the following keys are translated to HTML: |
| 66 | |
| 67 | - ``tagName`` |
| 68 | - ``attributes`` |
| 69 | - ``children`` (must be strings or more VDOM dicts) |
| 70 | |
| 71 | Parameters: |
| 72 | vdom: The VdomDict element to convert to HTML |
| 73 | """ |
| 74 | temp_root = etree.Element("__temp__") |
| 75 | _add_vdom_to_etree(temp_root, vdom) |
| 76 | html = cast(bytes, tostring(temp_root)).decode() |
| 77 | # strip out temp root <__temp__> element |
| 78 | return html[10:-11] |
| 79 | |
| 80 | |
| 81 | def html_to_vdom( |