site/wiki/Makefile

54 lines
1.2 KiB
Makefile
Raw Permalink Normal View History

SRC_MD_FILES != find source -name '*.md'
DST_HTML_FILES := $(SRC_MD_FILES:source/%.md=%.html)
DST_TXT_FILES := $(SRC_MD_FILES:source/%.md=%.txt)
PANDOC != command -v pandoc 2> /dev/null
PHP != command -v php 2> /dev/null
all: dep-pandoc $(DST_HTML_FILES) $(DST_TXT_FILES) index
index: dep-php index.html
2019-12-08 07:37:04 +00:00
%.html: %.php
php $< > $@
%.html: source/%.md wiki.tmpl custom.theme
2019-10-01 16:59:22 +00:00
$(info building $@)
2019-09-24 15:07:46 +00:00
@$(PANDOC) \
--from markdown+backtick_code_blocks \
2020-05-06 04:50:17 +00:00
--include-before-body=../nav.html \
--template wiki.tmpl \
--lua-filter header-permalinks.lua \
--highlight-style=custom.theme \
--title-prefix "tilde.club wiki" \
2019-09-23 03:46:32 +00:00
--variable toc-title:"table of contents" \
--standalone \
--table-of-contents \
--output $@ \
$<
%.txt: source/%.md link_footnote.lua
$(info building $@)
@$(PANDOC) \
--from markdown+backtick_code_blocks \
--to plain \
--lua-filter ./link_footnote.lua \
--standalone \
--output $@ \
$<
clean:
2019-10-01 16:59:22 +00:00
$(info removing generated files)
2020-05-06 04:50:17 +00:00
-rm *.html *.txt
dep-pandoc::
2019-10-01 16:59:22 +00:00
ifndef PANDOC
$(error missing dependency 'pandoc'. please install and try again)
endif
dep-php::
ifndef PHP
$(error missing dependency 'php'. please install and try again)
endif
2019-10-01 16:59:22 +00:00
.PHONY: clean dep-pandoc