/ Makefile
Makefile
 1  .PHONY: clean multipage
 2  
 3  IN = README.adoc
 4  OPTS = \
 5  	--failure-level info \
 6  	--trace \
 7  	-v
 8  OUT = README.html
 9  OUT_DIR = out
10  OUT_MULTIPAGE_DIR = $(OUT_DIR)/multipage
11  OUT_MULTIPAGE = $(OUT_MULTIPAGE_DIR)/README.html
12  HEAD = head.html
13  BODY = body.html
14  FOOT = foot.html
15  MEDIA =
16  
17  ifeq ($(MEDIA),)
18  	MEDIA_CMD =
19  else
20  	MEDIA_CMD = -a china-dictatorship-media-base='$(MEDIA)'
21  endif
22  
23  $(OUT): $(IN) $(HEAD) $(FOOT) template_dir/*
24  	@# --embedded + head/foot originally added to fix image height:
25  	@# https://stackoverflow.com/questions/63464732/how-to-set-a-custom-image-height-for-an-image-in-asciidoctor
26  	@#
27  	@# --template-dir initially added for loading="lazy" on images and youtube iframes:
28  	@# https://stackoverflow.com/questions/63917971/how-to-create-custom-html-output-for-an-existing-asciidoctor-asciidoc-macro
29  	@#
30  	@# --template-dir not in opts due to:
31  	@# https://github.com/owenh000/asciidoctor-multipage/issues/19
32  	@# It is not however very important in multipage output.
33  	bundle exec asciidoctor \
34  		$(MEDIA_CMD) \
35  	  --embedded \
36  	  -o $(BODY) \
37  		--template-dir template_dir \
38  	  $(OPTS) \
39  	  '$<'
40  	cat $(HEAD) $(BODY) $(FOOT) > '$@'
41  
42  multipage: $(OUT_MULTIPAGE)
43  
44  $(OUT_MULTIPAGE): $(IN) template_dir/*
45  	bundle exec asciidoctor \
46  		-D '$(OUT_MULTIPAGE_DIR)' \
47  		-a multipage-level=6 \
48  		-b multipage_html5 \
49  		-r asciidoctor-multipage \
50  	  $(OPTS) \
51  	  '$<'
52  	./generate-redirects
53  
54  clean:
55  	rm -rf $(OUT) $(BODY)