2021-07-27 12:12:27 +01:00
|
|
|
.PHONY: clean multipage
|
2020-09-07 02:00:01 +00:00
|
|
|
|
2021-07-27 12:12:27 +01:00
|
|
|
IN = README.adoc
|
|
|
|
|
OPTS = \
|
|
|
|
|
--failure-level info \
|
|
|
|
|
--template-dir template_dir \
|
|
|
|
|
--trace \
|
|
|
|
|
-v
|
2020-09-07 02:00:01 +00:00
|
|
|
OUT = README.html
|
2021-07-27 12:12:27 +01:00
|
|
|
OUT_DIR = out
|
|
|
|
|
OUT_MULTIPAGE_DIR = $(OUT_DIR)/multipage
|
|
|
|
|
OUT_MULTIPAGE = $(OUT_MULTIPAGE_DIR)/README.html
|
2020-09-07 02:00:01 +00:00
|
|
|
HEAD = head.html
|
2021-07-21 18:51:48 +01:00
|
|
|
BODY = body.html
|
2020-09-07 02:00:01 +00:00
|
|
|
FOOT = foot.html
|
2020-09-14 02:00:01 +00:00
|
|
|
MEDIA =
|
|
|
|
|
|
|
|
|
|
ifeq ($(MEDIA),)
|
|
|
|
|
MEDIA_CMD =
|
|
|
|
|
else
|
|
|
|
|
MEDIA_CMD = -a china-dictatorship-media-base='$(MEDIA)'
|
|
|
|
|
endif
|
2020-09-07 02:00:01 +00:00
|
|
|
|
2021-07-27 12:12:27 +01:00
|
|
|
$(OUT): $(IN) $(HEAD) $(FOOT) template_dir/*
|
2020-09-16 08:00:07 +00:00
|
|
|
@# --embedded + head/foot originally added to fix image height:
|
|
|
|
|
@# https://stackoverflow.com/questions/63464732/how-to-set-a-custom-image-height-for-an-image-in-asciidoctor
|
|
|
|
|
@#
|
|
|
|
|
@# --template-dir initially added for loading="lazy" on images and youtube iframes:
|
|
|
|
|
@# https://stackoverflow.com/questions/63917971/how-to-create-custom-html-output-for-an-existing-asciidoctor-asciidoc-macro
|
2020-09-07 10:00:09 +00:00
|
|
|
bundle exec asciidoctor \
|
2020-09-14 02:00:01 +00:00
|
|
|
$(MEDIA_CMD) \
|
2020-09-07 10:00:09 +00:00
|
|
|
--embedded \
|
|
|
|
|
-o $(BODY) \
|
2021-07-27 12:12:27 +01:00
|
|
|
$(OPTS) \
|
2020-09-07 10:00:09 +00:00
|
|
|
'$<'
|
2020-09-07 02:00:01 +00:00
|
|
|
cat $(HEAD) $(BODY) $(FOOT) > '$@'
|
|
|
|
|
|
2021-07-27 12:12:27 +01:00
|
|
|
multipage: $(OUT_MULTIPAGE)
|
|
|
|
|
|
|
|
|
|
$(OUT_MULTIPAGE): $(IN) template_dir/*
|
|
|
|
|
bundle exec asciidoctor \
|
|
|
|
|
-D '$(OUT_MULTIPAGE_DIR)' \
|
|
|
|
|
-a multipage-level=6 \
|
|
|
|
|
-b multipage_html5 \
|
|
|
|
|
-r asciidoctor-multipage \
|
|
|
|
|
$(OPTS) \
|
|
|
|
|
'$<'
|
|
|
|
|
|
2020-09-07 02:00:01 +00:00
|
|
|
clean:
|
|
|
|
|
rm -rf $(OUT) $(BODY)
|