Repository navigation
Expand file tree
/
Copy pathwebsite.mak
More file actions
71 lines (53 loc) · 2.71 KB
/
Copy pathwebsite.mak
File metadata and controls
71 lines (53 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#
# Makefile for the scripttool website: pandoc builds an HTML page beside each Markdown
# page, the Markdown pages are published as they are, for BonBon browsers and
# cmarkbrowser, and toc.bash writes /.well-known/toc.opml.
#
# The pages are listed by name, not globbed, so the site does not change with
# whatever .md files happen to sit in the directory. site_test.go checks that
# every published page is listed and that the built files are current.
# README.md becomes index.html and index.md.
#
# Written by hand from cmarkbrowser's website.mak; do not regenerate it with cmt.
#
PROJECT = scripttool
# Where the site is published (GitHub Pages, gh-pages branch).
BASE_URL = https://rsdoiel.github.io/scripttool/
PANDOC = $(shell which pandoc)
PROGRAMS = scripttool
# Every published page, in the order of the table of contents, README.md first:
# it is the home page. TODO.md and index.md (a copy of README.md) are not pages.
PAGE_ORDER = README.md user_manual.md scripttool.1.md scripttool-fadein.7.md scripttool-fdx.7.md scripttool-osf.7.md scripttool-fountain.7.md scripttool-characters.7.md scripttool-options.7.md scripttool-examples.7.md testdata.md release-notes.md INSTALL.md INSTALL_NOTES_macOS.md INSTALL_NOTES_Windows.md CHANGES.md about.md
NO_PUBLISH = TODO.md NOTES.md index.md
MD_PAGES = $(filter-out $(NO_PUBLISH),$(shell ls -1 *.md))
MISSING = $(filter-out $(PAGE_ORDER),$(MD_PAGES))
HTML_PAGES = $(patsubst README.html,index.html,$(patsubst %.md,%.html,$(PAGE_ORDER)))
TOC = .well-known/toc.opml
build: check-order $(HTML_PAGES) index.md $(TOC) .nojekyll
check-order:
@if [ -n "$(MISSING)" ]; then echo "website.mak: add to PAGE_ORDER: $(MISSING)" >&2; exit 1; fi
# Pandoc is optional; without it the existing pages are left as they are.
# Each HTML page names its Markdown page, for a reader that finds the HTML first.
$(HTML_PAGES): .FORCE
@if [ -z "$(PANDOC)" ]; then echo "website: pandoc not found, skipping $@" >&2; else \
SRC="$(patsubst index.html,README.html,$@)"; SRC="$${SRC%.html}"; \
PUBLISHED="$${SRC}.md"; if [ "$${SRC}" = "README" ]; then PUBLISHED="index.md"; fi; \
$(PANDOC) --metadata title="$${SRC}" -V markdown-source="$${PUBLISHED}" \
-s --to html5 "$${SRC}.md" -o "$@" \
--lua-filter=links-to-html.lua \
--lua-filter=add-col-scope.lua \
--template=page.tmpl; fi
# A BonBon browser asks for the site's address and gets index.md.
index.md: README.md
cp README.md index.md
# GitHub Pages hides folders that start with a dot (and so /.well-known/)
# unless the site says it is not a Jekyll site.
.nojekyll:
touch .nojekyll
$(TOC): $(MD_PAGES) toc.bash
mkdir -p $(dir $(TOC))
./toc.bash $(BASE_URL) $(PROJECT) $(PAGE_ORDER) > $(TOC).tmp
mv $(TOC).tmp $(TOC)
clean:
@rm -f $(HTML_PAGES)
.FORCE: