commit 676eb0e85ca242250dcf2463d5447ccc0a1c2114
parent 51e8ca3908b2b1d67403bcc17c027333618a931e
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date: Sat, 14 Mar 2020 00:57:36 +0100
Turn READMEs into HTML indices
Diffstat:
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/repo/www/TODO b/repo/www/TODO
@@ -1,4 +1,3 @@
-- READMEs ⇒ index.html
- "leak count" on toplevel index
- autogenerated index.html's for subfolders lacking READMEs
- stylin'
diff --git a/repo/www/make-deps.py b/repo/www/make-deps.py
@@ -22,8 +22,17 @@ def find_sources(top_dir):
def html_path(source_path, top_dir, out_dir):
- _, ext = path.splitext(source_path)
- return source_path.replace(top_dir, out_dir).replace(ext, '.html')
+ fname = path.basename(source_path)
+ dname = path.dirname(source_path)
+
+ name, _ = path.splitext(fname)
+
+ if name == 'README':
+ name = 'index'
+
+ return path.join(
+ out_dir, path.relpath(dname, top_dir), f'{name}.html'
+ )
def write_dependencies(output, sources, top_dir, out_dir):