diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-08-08 18:05:56 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-08-08 18:09:17 +0200 |
| commit | faf72059492df8cd09d9ecd805111a8aaa77a221 (patch) | |
| tree | 721f81a9e53a7c6f09fe64a2f82ad9ac80024a86 | |
| parent | 19e95772a8b8ba047703089f643df5e3805d9969 (diff) | |
| download | memory-leaks-faf72059492df8cd09d9ecd805111a8aaa77a221.tar.xz | |
Add default pandoc template for HTML
| -rw-r--r-- | repo/www/Makefile | 6 | ||||
| -rwxr-xr-x | repo/www/generate-index.py | 2 | ||||
| -rw-r--r-- | repo/www/template.html | 64 |
3 files changed, 70 insertions, 2 deletions
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 @@ +<!DOCTYPE html> +<html xmlns="http://www.w3.org/1999/xhtml" lang="$lang$" xml:lang="$lang$"$if(dir)$ dir="$dir$"$endif$> +<head> + <meta charset="utf-8" /> + <meta name="generator" content="pandoc" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" /> +$for(author-meta)$ + <meta name="author" content="$author-meta$" /> +$endfor$ +$if(date-meta)$ + <meta name="dcterms.date" content="$date-meta$" /> +$endif$ +$if(keywords)$ + <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" /> +$endif$ + <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title> + <style> + $styles.html()$ + </style> +$for(css)$ + <link rel="stylesheet" href="$css$" /> +$endfor$ +$if(math)$ + $math$ +$endif$ + <!--[if lt IE 9]> + <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script> + <![endif]--> +$for(header-includes)$ + $header-includes$ +$endfor$ +</head> +<body> +$for(include-before)$ +$include-before$ +$endfor$ +$if(title)$ +<header id="title-block-header"> +<h1 class="title">$title$</h1> +$if(subtitle)$ +<p class="subtitle">$subtitle$</p> +$endif$ +$for(author)$ +<p class="author">$author$</p> +$endfor$ +$if(date)$ +<p class="date">$date$</p> +$endif$ +</header> +$endif$ +$if(toc)$ +<nav id="$idprefix$TOC" role="doc-toc"> +$if(toc-title)$ +<h2 id="$idprefix$toc-title">$toc-title$</h2> +$endif$ +$table-of-contents$ +</nav> +$endif$ +$body$ +$for(include-after)$ +$include-after$ +$endfor$ +</body> +</html> |
