diff options
Diffstat (limited to 'repo/www')
| -rw-r--r-- | repo/www/Makefile | 10 | ||||
| -rw-r--r-- | repo/www/TODO | 2 | ||||
| -rwxr-xr-x | repo/www/generate-index.py | 11 |
3 files changed, 15 insertions, 8 deletions
diff --git a/repo/www/Makefile b/repo/www/Makefile index c236936..cdc7ee2 100644 --- a/repo/www/Makefile +++ b/repo/www/Makefile @@ -40,15 +40,21 @@ html_folders = $(call dirnames,$(pages) $(indices)) $(html_folders) $(cache): mkdir -p $@ -$(pages) $(indices): $(title) +$(pages) $(subindices): $(title) $(pages): $(OUT_DIR)/%.html: pandoc -s $< -o $@ -T "$$(cat $(title))" -M title="$*" +top_index = $(OUT_DIR)/index.html +subindices = $(filter-out $(top_index),$(indices)) + +$(top_index): index_options = +$(subindices): index_options = --site-title="$$(cat $(title))" + # ⚠ When tweaking this rule, check whether it still works for the # top-level index.html. $(indices): $(OUT_DIR)/%index.html: - ./generate-index.py $(site_tree) "$$(cat $(title))" "$(patsubst %/,%,$*)" $@ + ./generate-index.py $(index_options) $(site_tree) "$(patsubst %/,%,$*)" $@ clean: -rm $(dependencies) diff --git a/repo/www/TODO b/repo/www/TODO index 09adbae..4ac72db 100644 --- a/repo/www/TODO +++ b/repo/www/TODO @@ -1,5 +1,5 @@ -- fix redundant title prefix on toplevel index page - compute "leak count" on toplevel index +- lua filter to s/.md/.html on links - autogenerate nav - autogenerate breadcrumbs - get stylin' diff --git a/repo/www/generate-index.py b/repo/www/generate-index.py index 62daf79..1fb00e6 100755 --- a/repo/www/generate-index.py +++ b/repo/www/generate-index.py @@ -17,7 +17,7 @@ def parse_arguments(): 'site_tree', help='JSON file describing the page tree.' ) parser.add_argument( - 'site_title', help='Title to add to <title>.' + '--site-title', help='Prefix to add to <title>.' ) parser.add_argument( 'target', help='Subfolder to generate an index for.' @@ -97,10 +97,11 @@ def format_index(target, directories, files): def convert_page(content, output, site_title): - run( - ('pandoc', '-s', '-o', output, '-T', site_title), - input=content, check=True, text=True - ) + pandoc = ('pandoc', '-s', '-o', output) + if site_title is not None: + pandoc += ('-T', site_title) + + run(pandoc, input=content, check=True, text=True) def main(arguments): |
