From faf72059492df8cd09d9ecd805111a8aaa77a221 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Sat, 8 Aug 2020 18:05:56 +0200 Subject: Add default pandoc template for HTML --- repo/www/Makefile | 6 ++++- repo/www/generate-index.py | 2 +- repo/www/template.html | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 repo/www/template.html (limited to 'repo') diff --git a/repo/www/Makefile b/repo/www/Makefile index d74a77c..c1bbb28 100644 --- a/repo/www/Makefile +++ b/repo/www/Makefile @@ -13,6 +13,7 @@ dirnames = $(sort $(call dirname,$(1))) text_patterns = $(foreach ext,$(TEXT_FILES),'$(TOP_DIR)/**.$(ext)') text_folders = $(call dirnames,$(shell git ls-files $(text_patterns))) top_readme = $(shell git ls-files $(addprefix $(TOP_DIR)/README.,$(TEXT_FILES))) +html_template = template.html all: site @@ -47,10 +48,13 @@ $(html_folders) $(cache): $(pages) $(subindices): $(title) +$(pages) $(indices): $(html_template) + $(pages): $(OUT_DIR)/%.html: $(call v,PAGE,$*) TEXT_FILES="$(TEXT_FILES)" \ pandoc -s $< -o $@ \ - -T "$$(cat $(title))" -M title="$*" \ + -T "$$(cat $(title))" -M title="$*" \ + --template $(html_template) \ --lua-filter convert-internal-links.lua top_index = $(OUT_DIR)/index.html diff --git a/repo/www/generate-index.py b/repo/www/generate-index.py index 4353819..5cd33a0 100755 --- a/repo/www/generate-index.py +++ b/repo/www/generate-index.py @@ -99,7 +99,7 @@ def format_index(target, directories, files): def convert_page(content, output, site_title): pandoc = ( 'pandoc', '-s', '--lua-filter', 'convert-internal-links.lua', - '-o', output + '--template', 'template.html', '-o', output ) if site_title is not None: pandoc += ('-T', site_title) diff --git a/repo/www/template.html b/repo/www/template.html new file mode 100644 index 0000000..0676215 --- /dev/null +++ b/repo/www/template.html @@ -0,0 +1,64 @@ + + + + + + +$for(author-meta)$ + +$endfor$ +$if(date-meta)$ + +$endif$ +$if(keywords)$ + +$endif$ + $if(title-prefix)$$title-prefix$ – $endif$$pagetitle$ + +$for(css)$ + +$endfor$ +$if(math)$ + $math$ +$endif$ + +$for(header-includes)$ + $header-includes$ +$endfor$ + + +$for(include-before)$ +$include-before$ +$endfor$ +$if(title)$ +
+

$title$

+$if(subtitle)$ +

$subtitle$

+$endif$ +$for(author)$ +

$author$

+$endfor$ +$if(date)$ +

$date$

+$endif$ +
+$endif$ +$if(toc)$ + +$endif$ +$body$ +$for(include-after)$ +$include-after$ +$endfor$ + + -- cgit v1.2.3