-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathcommon.mk
More file actions
46 lines (31 loc) · 1.04 KB
/
Copy pathcommon.mk
File metadata and controls
46 lines (31 loc) · 1.04 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
COMMON_MK := $(lastword $(MAKEFILE_LIST))
.PHONY: help
help:
@grep "^.PHONY" $(COMMON_MK) | cut -d' ' -f2
cards.apkg: cards.md
anki-panky $<
cards-with-name.md: cards.md
deck_name=$$(awk '/^name:/{sub(/^name: */,""); print; exit}' $<); \
awk -v name="$$deck_name" 'BEGIN{y=0} /^-{3,}$$/ {print; if(y<2){y++; next} print ""; print "`<small style=\"color:#888\">" name "</small>`{=html}`{\\small\\color{gray} " name "}`{=latex}"; next} {print}' $< > $@
cards-with-name.apkg: cards-with-name.md
anki-panky $<
cards.pdf: cards.md
pandoc \
--pdf-engine tectonic \
--variable "geometry:papersize={130mm,130mm}" \
--variable "fontsize: 10pt" \
--variable "monofont:Hasklug Nerd Font Mono" \
--variable "monofontoptions:Scale=0.7, FontFace={weight=700}" \
--to beamer \
--output $@ \
$<
.PHONY: build
build: cards.apkg cards-with-name.apkg cards.pdf
.PHONY: test
test: cards.apkg
unzip cards.apkg -d cards-test
ls -l cards-test
.PHONY: clean
clean:
rm -f cards.apkg cards.pdf cards-with-name.md cards-with-name.apkg
rm -rf cards-test