From: Oleg Broytman Date: Sun, 15 Mar 2015 23:14:05 +0000 (+0300) Subject: gen-sitemap: generate simple html X-Git-Url: https://git.phdru.name/?p=phdru.name%2Fphdru.name.git;a=commitdiff_plain;h=2f9b1d1da8492b7e0456953e585f247adfcbe3ab gen-sitemap: generate simple html --- diff --git a/gen-sitemap.py b/gen-sitemap.py index b6ab57d..63b34a2 100755 --- a/gen-sitemap.py +++ b/gen-sitemap.py @@ -3,6 +3,7 @@ import argparse from fnmatch import fnmatch import os +from news import write_if_changed parser = argparse.ArgumentParser(description='Generate sitemap') parser.add_argument('-x', '--exclude', action='append', @@ -46,3 +47,24 @@ for dirpath, dirs, files in sorted(os.walk(fullpath)): save_level = level except StopIteration: pass + +def _tree2html(tree, level=0): + indent = " " * level + strings = [] + strings.append(indent + "") + return '\n'.join(strings) + +write_if_changed("sitemap.html", _tree2html(tree[1]))