forked from openjournals/inara
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
64 lines (54 loc) · 1.81 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
# Path to paper file
ARTICLE = paper.md
# The Journal under which the article is to be published.
# Currently either `joss` or `jose`.
JOURNAL = neurolibre
# Path to OpenJournals resources like logos, csl style file, etc.
OPENJOURNALS_PATH = resources
# Data path, containing configs, filters.
INARA_DATA_PATH = data
# The pandoc executable
PANDOC = pandoc
# Folder in which the outputs will be placed
TARGET_FOLDER = publishing-artifacts
ARTICLE_INFO_FILE = $(OPENJOURNALS_PATH)/default-article-info.yaml
.PHONY: all
all: pdf html jats crossref jats
.PHONY: pdf html jats crossref native
pdf: $(TARGET_FOLDER)/paper.pdf
html: $(TARGET_FOLDER)/paper.html
jats: $(TARGET_FOLDER)/paper.jats
native: $(TARGET_FOLDER)/paper.native
crossref: $(TARGET_FOLDER)/paper.crossref
$(TARGET_FOLDER)/paper.%: $(ARTICLE) \
$(INARA_DATA_PATH)/defaults/%.yaml \
$(OPENJOURNALS_PATH)/footer.csl \
$(ARTICLE_INFO_FILE) \
$(TARGET_FOLDER)
INARA_ARTIFACTS_PATH=$(TARGET_FOLDER)/ $(PANDOC) \
--data-dir=$(INARA_DATA_PATH) \
--defaults=shared \
--defaults=$*.yaml \
--defaults=$(OPENJOURNALS_PATH)/$(JOURNAL)/defaults.yaml \
--resource-path=.:$(OPENJOURNALS_PATH):$(dir $(ARTICLE)) \
--metadata=article-info-file=$(ARTICLE_INFO_FILE) \
--variable=$(JOURNAL) \
--output=$@ \
$<
$(TARGET_FOLDER):
mkdir -p $(TARGET_FOLDER)
.PHONY: docker-image
docker-image: Dockerfile
docker build --tag openjournals/inara .
push-docker-image:
docker push openjournals/inara
$(OPENJOURNALS_PATH)/footer.csl: $(OPENJOURNALS_PATH)/apa.csl
sed -e 's/et-al-use-first="[0-9]*"/et-al-use-first="1"/g' \
-e 's/et-al-min="[0-9]*"/et-al-min="3"/g' \
-e 's/et-al-use-last="true"/et-al-use-last="false"/g' \
$< > $@
.PHONY: clean
clean:
rm -rf $(TARGET_FOLDER)/paper.html
rm -rf $(TARGET_FOLDER)/paper.jats
rm -rf $(TARGET_FOLDER)/paper.pdf