From 591ab49266f87c70c77d04f6041af2b7245c7b34 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Sat, 26 Dec 2020 15:32:09 +0000 Subject: [PATCH] Add book/Makefile for local HTML generation. This is mainly useful for syntax checking rather than to produce good-quality output. It assumes that pandoc is installed. Signed-off-by: Daira Hopwood --- .gitignore | 1 + book/Makefile | 10 ++++++++++ book/edithtml.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 book/Makefile create mode 100755 book/edithtml.sh diff --git a/.gitignore b/.gitignore index 173b951..1bd93e2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ **/*.rs.bk Cargo.lock .vscode +**/*.html diff --git a/book/Makefile b/book/Makefile new file mode 100644 index 0000000..2fb3f9a --- /dev/null +++ b/book/Makefile @@ -0,0 +1,10 @@ +.PHONY: all +all: + find src -type f -a -name '*.md' |sed 's/[.]md$$/.html/g' |xargs $(MAKE) + +clean: + find src -type f -a -name '*.html' -print0 |xargs -0 rm + +%.html: %.md + pandoc --katex --from=markdown --to=html "$<" "--output=$@" + ./edithtml.sh "$@" "$<" diff --git a/book/edithtml.sh b/book/edithtml.sh new file mode 100755 index 0000000..4825478 --- /dev/null +++ b/book/edithtml.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +cat - "$1" > "$1.prefix" < + + + + + + $2 + + + + + + +EOF +cat "$1.prefix" - >"$1" < + +EOF +rm -f "$1.prefix"