memory-leaks

Still reachable: lots of words in many pages.
git clone https://git.kevinlegouguec.net/memory-leaks
Log | Files | Refs | README | LICENSE

commit c6f09513154c18076ec4d1150cabe0a22d83314a
parent 8692dba921531783b9204a9323db2aba640fe978
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date:   Sat, 25 Apr 2020 23:51:27 +0200

Remove redundant title prefix on top-level index

Diffstat:
Mrepo/www/Makefile | 10++++++++--
Mrepo/www/TODO | 2+-
Mrepo/www/generate-index.py | 11++++++-----
3 files changed, 15 insertions(+), 8 deletions(-)

diff --git 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 @@ -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 @@ -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):