forked from confcodeofconduct/confcodeofconduct.com
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
21 lines (18 loc) · 792 Bytes
/
Makefile
File metadata and controls
21 lines (18 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
INPUT := $(sort $(wildcard src/content/*.html))
OUTPUT := $(patsubst src/content/%.html,public/index-%.html,$(INPUT))
TEMP_TITLE_FILE := $(TMPDIR)/communitycodeofconduct-title
TEMP_CONTENT_FILE := $(TMPDIR)/communitycodeofconduct-content
.PHONY: all
all: $(OUTPUT)
public/index-%.html: src/content/%.html src/index.html
@ echo $< '->' $@
@ if [[ -e 'src/titles/$*.html' ]]; then \
sed -E -e 's/^/ /' -e 's/\s+$$//' src/titles/$*.html > $(TEMP_TITLE_FILE); \
else \
sed -E -e 's/^/ /' -e 's/\s+$$//' src/titles/en.html > $(TEMP_TITLE_FILE); \
fi
@ sed -E -e 's/^/ /' -e 's/\s+$$//' $< > $(TEMP_CONTENT_FILE)
@ sed -E \
-e '/^\s*\{\{title\}\}\s*$$/r $(TEMP_TITLE_FILE)' -e '//d' \
-e '/^\s*\{\{content\}\}\s*$$/r $(TEMP_CONTENT_FILE)' -e '//d' \
src/index.html > $@