-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
107 lines (97 loc) · 2.46 KB
/
Makefile
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
.PHONY: all clean include
PUBLISH ?= publish
EDITOR ?= gvim
SRC:=$(wildcard index.md */*.md)
DST:=$(addprefix $(PUBLISH)/, $(SRC:%.md=%.html))
CSS:=$(PUBLISH)/github-markdown.css \
$(PUBLISH)/highlight.css \
$(PUBLISH)/lazyload.min.js \
$(PUBLISH)/jquery-3.0.0.min.js \
$(PUBLISH)/jquery.idTabs.min.js \
$(PUBLISH)/egg.min.js \
$(PUBLISH)/clipboard.min.js \
$(PUBLISH)/notes.js \
$(PUBLISH)/notes.css \
$(PUBLISH)/fork-me-on-github.png \
FROM := markdown+abbreviations
ifeq (,$(DUMB))
FROM := $(FROM)+east_asian_line_breaks+emoji+raw_tex
endif
all: $(DST) $(CSS)
clone:
@echo clone some other repo
# 注意是 https 的链接,不是 git 的。
# git clone --depth 1 https://github.com/4ker/LeetCode.git leetcode-maskray
# git clone --depth 1 https://github.com/4ker/cracking-the-coding-interview.git
# git clone --depth 1 https://github.com/district10/leetcode.git
serve:
cd $(PUBLISH); python -m SimpleHTTPServer
w: watch
watch: jwatch.jar
java -jar jwatch.jar -i "$(PUBLISH)"
jwatch.jar:
curl http://whudoc.qiniudn.com/2016/jwatch.jar > jwatch.jar
clean:
rm -rf $(PUBLISH)/*
include:
make -C include
gh:
git add -A; git commit -m "`uname`"; git push;
wiki:
java -jar wikify.jar -ps '#main-body' -ns '#main-body > ul > li > dl' -i $(PUBLISH)/ -o $(PUBLISH)/ -ccs 50 -ncs 50 -pcs 20
$(PUBLISH)/index.html: index.md
@mkdir -p $(@D)
(perl meta/cat.pl $< | perl meta/drawer.pl || cat $<) | \
pandoc \
-V ISINDEX=true \
-S -s --ascii --mathjax \
-f $(FROM) \
--template meta/note.template \
-o $@
$(PUBLISH)/%/index.html: %/index.md
@mkdir -p $(@D)
(perl meta/cat.pl $< | perl meta/drawer.pl || cat $<) | \
pandoc \
-V ISINDEX=true \
-V rootdir=../ \
-S -s --ascii --mathjax \
-f $(FROM) \
--template meta/note.template \
-o $@
$(PUBLISH)/%.html: %.md
@mkdir -p $(@D)
(perl meta/cat.pl $< | perl meta/drawer.pl || cat $<) | \
pandoc \
-V rootdir=../ \
-S -s --ascii --mathjax \
-f $(FROM) \
--template meta/note.template \
-o $@
$(PUBLISH)/%: meta/%
@mkdir -p $(@D)
cp $< $@
$(PUBLISH)/%: %
@mkdir -p $(@D)
cp $< $@
note: n
n:
$(EDITOR) -p \
2017/note4.md \
index.md \
lang/ruby.md \
m:
$(EDITOR) Makefile
t:
$(EDITOR) meta/note.template
j:
$(EDITOR) meta/notes.js
c:
$(EDITOR) meta/notes.css
sm: sitemap
sitemap:
touch $(PUBLISH)/sitemap.html
find $(PUBLISH)/ | \
sed -e "s/^$(PUBLISH)/- <http:\/\/tangzx.qiniudn.com\/notes/" | \
sed -e "s/$$/>/" | tee sitemap.md | \
pandoc --ascii -o $(PUBLISH)/sitemap.html
cat sitemap.md