From 3bbbd8e23e1747800d74b81aeea82712494303be Mon Sep 17 00:00:00 2001 From: Augusto Gunsch Date: Fri, 14 Jan 2022 20:22:15 -0300 Subject: [PATCH] Setup file browsing --- generate.py | 17 +++++++++++++++++ templates/stylesheet.css | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/generate.py b/generate.py index 85a1a6c..c8bff2a 100755 --- a/generate.py +++ b/generate.py @@ -27,10 +27,13 @@ for root, dirs, files in os.walk(input_, topdown=True): shutil.copy(templates + '/stylesheet.css', outroot + '/stylesheet.css') + outfiles = [] + for file in files: if file.endswith('.md'): basename = file[:-3] outfile = outroot + '/' + basename + '.html' + outfiles.append(basename + '.html') infile = root + '/' + file with open(infile, 'r') as f: @@ -43,3 +46,17 @@ for root, dirs, files in os.walk(input_, topdown=True): content=content) f.write(new_file) + + index_html = '' + + with open(outroot + '/index.html', 'w') as f: + f.write(render_template(title=outroot, + content=index_html)) diff --git a/templates/stylesheet.css b/templates/stylesheet.css index 762eab3..1bd70a2 100644 --- a/templates/stylesheet.css +++ b/templates/stylesheet.css @@ -1,3 +1,3 @@ body { - background-color: blue + background-color: yellow }