def write_view_hierarchy_tree_node()

in plugin/src/py/android_screenshot_tests/pull_screenshots.py [0:0]


def write_view_hierarchy_tree_node(node, html, parent_id, with_overlay_target):
    if with_overlay_target:
        html.write(
            '<details target="#%s-%s">'
            % (parent_id, get_view_hierarchy_overlay_node_id(node))
        )
    else:
        html.write("<details>")
    html.write("<summary>%s</summary>" % node.get(KEY_CLASS, DEFAULT_VIEW_CLASS))
    html.write("<ul>")
    for item in sorted(node):
        if item == KEY_CHILDREN or item == KEY_CLASS:
            continue
        html.write("<li><strong>%s:</strong> %s</li>" % (item, node[item]))

    html.write("</ul>")
    if KEY_CHILDREN in node and node[KEY_CHILDREN]:
        for child in node[KEY_CHILDREN]:
            write_view_hierarchy_tree_node(child, html, parent_id, with_overlay_target)

    html.write("</details>")