pass
def _tree2html(tree, level=0):
- indent = " " * level
- strings = []
- strings.append(indent + "<ul>")
-
- level += 1
- indent2 = " " * level
-
+ subparts = []
+ indent = " " * (level + 1)
for title, subtree in tree:
if subtree:
- strings.append(indent2 + "<li>%s" % title)
- strings.append(_tree2html(subtree, level+1))
- strings.append(indent2 + "</li>")
+ subparts.append(indent + "<li>%s" % title)
+ subparts.append(_tree2html(subtree, level+2))
+ subparts.append(indent + "</li>")
else:
- strings.append(indent2 + "<li>%s</li>" % title)
+ subparts.append(indent + "<li>%s</li>" % title)
+ s = "\n".join(subparts)
+
+ parts = []
+ indent = " " * level
+ parts.append(indent + "<ul>")
+ parts.append(s)
+ parts.append(indent + "</ul>")
- strings.append(indent + "</ul>")
- return '\n'.join(strings)
+ return "\n".join(parts)
sitemap_tmpl = ["""\
#extends phd_site