blob: 80ba4fc0503e77cf407e94cd717d16403adfd1d1 (
plain)
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
|
SRC_DIR := notes
BUILD_DIR := build
HTML_DIR := html
PAGE_DIR := pages
SOURCE_DOCS := $(wildcard $(SRC_DIR)/*.md)
PAGE_DOCS := $(wildcard $(PAGE_DIR)/*.md)
META_DOCS=$(patsubst $(SRC_DIR)/%,$(BUILD_DIR)/%,$(SOURCE_DOCS:.md=.meta))
HTML_DOCS=$(patsubst $(SRC_DIR)/%,$(HTML_DIR)/notes/%,$(SOURCE_DOCS:.md=.html))
SOURCE_FILES=$(patsubst $(SRC_DIR)/%,%,$(SOURCE_DOCS:.md=))
PAGE_FILES=$(patsubst $(PAGE_DIR)/%,$(HTML_DIR)/%,$(PAGE_DOCS:.md=.html))
$(BUILD_DIR)/%.meta: $(SRC_DIR)/%.md
@mkdir -p $(BUILD_DIR)
pandoc --write=tools/link_gen.lua $< -o $@
.PRECIOUS: $(META_DOCS)
$(HTML_DIR)/notes/%.html: $(BUILD_DIR)/%.meta $(META_DOCS)
@mkdir -p $(HTML_DIR)
@mkdir -p $(HTML_DIR)/notes
pandoc -s --template=./templates/main.html \
--lua-filter=./tools/note.lua \
$(patsubst $(BUILD_DIR)/%,$(SRC_DIR)/%,$(<:.meta=.md)) \
--highlight-style=pygments \
-o $@
$(HTML_DIR)/%.html: $(PAGE_DIR)/%.md
@mkdir -p $(HTML_DIR)
pandoc -s --template=./templates/main.html \
$< \
--highlight-style=pygments \
-M main_class="html-main-page" \
-M main_container="main-container-page" \
-o $@
html/feed.xml: $(META_DOCS)
./tools/rss_gen.py
$(HTML_DIR)/index.html: $(HTML_DOCS) $(PAGE_FILES) html/feed.xml
touch $(HTML_DIR)/.nojekyll
pandoc -s --lua-filter=./tools/front_page.lua --template=./templates/main.html main.md \
--metadata=note_list:"$(SOURCE_FILES)" \
-o $@
.PHONY: all clean
all: $(HTML_DIR)/index.html
deploy: all
git subtree push --prefix html origin gh-pages
clean:
rm -r build
find html -name "*.html" -type f -delete
|