+
+def _tree2html(tree, level=0):
+ indent = " " * level
+ strings = []
+ strings.append(indent + "<ul>")
+
+ level += 1
+ indent2 = " " * level
+
+ for title, subtree in tree:
+ if subtree:
+ strings.append(indent2 + "<li>%s" % title)
+ strings.append(_tree2html(subtree, level+1))
+ strings.append(indent2 + "</li>")
+ else:
+ strings.append(indent2 + "<li>%s</li>" % title)
+
+ strings.append(indent + "</ul>")
+ return '\n'.join(strings)
+
+write_if_changed("sitemap.html", _tree2html(tree[1]))