forked from pjheslin/diogenes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmk.pdf-data
45 lines (31 loc) · 1.39 KB
/
mk.pdf-data
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
# Rules to extract bookmarks from the PDFs distributed by the
# Thesaurus Linguae Latinae. Pass the directory containing the PDFs
# on the command-line as TLLDIR for TLL and as OLDFILE for OLD.
# Requires qpdf and pdftk.
.DEFAULT_GOAL := all
include mk.common
DATAFILES = \
$(DATA)/tll-bookmarks.txt \
$(DATA)/tll-bookmarks.idt \
$(DATA)/tll-pdf-list.txt \
$(DATA)/old-bookmarks.txt
$(BUILD)/index.json:
curl -k -o $@ https://publikationen.badw.de/de/thesaurus/-/index.json
all: $(DATAFILES)
.SUFFIXES: .txt .idt
.txt.idt:
./utils/make_index.pl < $< > $@
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_dir := $(dir $(mkfile_path))
# Former code that extracted info from bookmarks in the PDFs; doesn't work for newest files.
# $(DATA)/tll-bookmarks.txt: utils/make_pdf_bookmarks.pl
# utils/make_pdf_bookmarks.pl -t "$(TLLDIR)" -l "$(mkfile_dir)/$(DATA)" > $(DATA)/tll-bookmarks.txt
# New code that uses the index.json file from the TLL
$(DATA)/tll-bookmarks.txt: utils/get_tll_bookmarks.pl $(BUILD)/index.json
utils/get_tll_bookmarks.pl -t "$(TLLDIR)" -l "$(mkfile_dir)/$(DATA)" -i "$(BUILD)/index.json" > $(DATA)/tll-bookmarks.txt
$(DATA)/old-bookmarks.txt: utils/make_pdf_bookmarks.pl
utils/make_pdf_bookmarks.pl -o "$(OLDFILE)" > $(DATA)/old-bookmarks.txt
$(DATA)/tll-bookmarks.idt: $(DATA)/tll-bookmarks.txt
$(DATA)/tll-pdf-list.txt: $(DATA)/tll-bookmarks.txt
clean:
rm -f $(DATAFILES)