forked from bmschmidt/CV-pandoc-healy
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
executable file
·49 lines (39 loc) · 1.54 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
SHELL := /bin/bash
.PHONY: FORCE_MAKE
all: cv-zach.pdf
#pdf: clean $(PDFS)
#html: clean $(HTML)
%.pdf: %.tex FORCE_MAKE
./vc.sh
latexmk -dvi- -pdf $*
yaml-cv.md: curriculum_vitae.yaml
# Pandoc can't actually read YAML, just YAML blocks in
# Markdown. So I give it a document that's just a YAML block,
# while still editing a straight YAML file which has a bunch of advantages.
cat $< > $@
%.tex: template-%.tex yaml-cv.md
# Pandoc does the initial compilation to tex; we then latex handle the
# actual bibliography and pdf creation.
pandoc --template=$< -t latex yaml-cv.md > $@
# Citekeys get screwed up by pandoc which escapes the underscores.
# Years should have en-dashes, which damned if I'm going to do it
# on my own.
perl -pi -e 'if ($$_=~/cite\{/) {s/\\_/_/g}; s/(\d{4})-(\.|[Pp]resent|\d{4})/$$1--$$2/g' $@;
%-scholar.tex: FORCE_MAKE
rm -f $@
for cids in `grep 'scholar =' zach.bib|sed 's/^[^0-9]*//;s/[^0-9]*$$//'` ; do \
sleep "$$((3+$$RANDOM % 15))m" ;\
sleep 1s ;\
cidss=`echo $$cids | sed 's/,/ /g'` ;\
cites=`./citecount $$cidss` ;\
echo "$$cites citations for $$cidss" ;\
if [ "$$cites" -gt "0" ] ; then \
echo "\defscholar{$$cids}{$$cites}" >> $@ ;\
fi ;\
done
%.md: template-%.md yaml-cv.md zach.bib publication-list.csl
sed 's/-[0-9][0-9]-[0-9][0-9]//g;s/\\\\emph{\([^}]*\)}/_\1_/g;' yaml-cv.md | pandoc --template=$< -t markdown | pandoc --citeproc --bibliography=zach.bib -t markdown > $@
%.html: %.md
pandoc -s -f markdown -t html $< > $@
clean:
rm -f *.aux *.bcf *.log *.out *.run.xml *.pdf *.bbl *.blg *yaml-cv.md