43 lines
1.7 KiB
Makefile
43 lines
1.7 KiB
Makefile
SHELL = /bin/sh
|
|
INSTALLDIR := ./public_html/eh/eh/eh/eh-eh/
|
|
|
|
# The name of the stylesheet. This needs to be copied to any directory containing html files that use it.
|
|
style := style.css
|
|
images := images
|
|
|
|
# Main html template that pandoc uses to generate .html from .md files
|
|
template := pandoc/template.html
|
|
|
|
# Template for extracting metadata of .md files in json format
|
|
list_template := pandoc/meta-json-template.txt
|
|
|
|
# List of articles with their metadata to be used in the creation of the article list in index.html
|
|
article_list := articles.json
|
|
|
|
# article targets
|
|
articles := $(patsubst %.md,%.html,$(wildcard articles/*.md))
|
|
|
|
all: index.html about.html
|
|
|
|
install:
|
|
cp -r index.html about.html $(articles) $(style) $(images) $(INSTALLDIR); \
|
|
|
|
clean:
|
|
echo '{"articles": []}' > $(article_list); \
|
|
rm index.html about.html $(articles);
|
|
|
|
$(articles): %.html: %.md
|
|
# Build articles using pandoc
|
|
pandoc $< --template $(template) --css $(style) --highlight-style zenburn --mathml --toc --output $@; \
|
|
|
|
# Extract metadata from .md file, append filename field to the article object.
|
|
# This is used to link to the article from index.html. Append article object to the article list.
|
|
jq '.articles += [$(shell pandoc $< --template $(list_template) | jq '. += {"filename": "$(notdir $@)"}' )]' $(article_list) > articles.json.tmp; \
|
|
mv ./articles.json.tmp $(article_list); \
|
|
|
|
index.html: index.md $(articles)
|
|
# Build index.html with metadata injected from articles_list
|
|
pandoc $< --template $(template) --css $(style) --metadata-file $(article_list) --highlight-style zenburn --mathml --toc --output $@; \
|
|
|
|
about.html: about.md
|
|
pandoc $< --template $(template) --css $(style) --highlight-style zenburn --mathml --toc --output $@
|