]> git.phdru.name Git - phdru.name/phdru.name.git/commitdiff
gen-sitemap: generate template
authorOleg Broytman <phd@phdru.name>
Sun, 15 Mar 2015 23:21:36 +0000 (02:21 +0300)
committerOleg Broytman <phd@phdru.name>
Wed, 23 Dec 2015 15:54:10 +0000 (18:54 +0300)
gen-sitemap.py

index 63b34a2ff5ce9af1df3e161410d56205de97d76b..088f83819e4c8d491fa0ac69e4eb8ab632c3cb06 100755 (executable)
@@ -67,4 +67,20 @@ def _tree2html(tree, level=0):
     strings.append(indent + "</ul>")
     return '\n'.join(strings)
 
     strings.append(indent + "</ul>")
     return '\n'.join(strings)
 
-write_if_changed("sitemap.html", _tree2html(tree[1]))
+sitemap_tmpl = ["""\
+#extends phd_site
+#implements respond
+#attr $Title = 'Sitemap'
+#attr $Copyright = 2015
+##
+#def body_html
+"""]
+
+sitemap_tmpl.append(_tree2html(tree[1]))
+
+sitemap_tmpl.append("""
+#end def
+$phd_site.respond(self)
+""")
+
+write_if_changed("sitemap.tmpl", ''.join(sitemap_tmpl))