1
0

workaround for pandoc not being present in Cloudflare Pages platform V2 part 9

This commit is contained in:
Simon Michael
2023-11-29 08:04:42 -10:00
parent aaab755a87
commit 5d7a2983e6

View File

@@ -1,27 +1,25 @@
all: pandoc html pandoc-remove all: html
# XXX temporary workaround for pandoc not being present in Cloudflare Pages platform V2
# pandoc --version || sudo apt install -y pandoc
pandoc:
pandoc --version || \
wget https://github.com/jgm/pandoc/releases/download/3.1.9/pandoc-3.1.9-linux-amd64.tar.gz && \
tar xzf pandoc-3.1.9-linux-amd64.tar.gz
# Too large, cloudflare won't deploy
pandoc-remove:
rm -rf pandoc-3.1.9*
#PANDOC=pandoc
PANDOC=pandoc-3.1.9/bin/pandoc \
-f markdown-smart-tex_math_dollars+autolink_bare_uris+wikilinks_title_after_pipe \
--lua-filter=fixwikilinks.lua
# Generate html from all md files in src/, in out/ # Generate html from all md files in src/, in out/
html: $(patsubst src/%,out/%,$(patsubst %.md,%.html,$(wildcard src/*.md src/quickref/*.md))) Makefile html: $(patsubst src/%,out/%,$(patsubst %.md,%.html,$(wildcard src/*.md src/quickref/*.md))) Makefile
PANDOC?=pandoc
# temporary workaround for cloudflare pages (pandoc is too old in V1, missing in V2)
html-cfp:
pandoc --version || ( \
wget https://github.com/jgm/pandoc/releases/download/3.1.9/pandoc-3.1.9-linux-amd64.tar.gz && \
tar xzf pandoc-3.1.9-linux-amd64.tar.gz )
make html PANDOC=pandoc-3.1.9/bin/pandoc
rm -rf pandoc-3.1.9*
MD2HTML=$(PANDOC) \
-f markdown-smart-tex_math_dollars+autolink_bare_uris+wikilinks_title_after_pipe \
--lua-filter=fixwikilinks.lua
# generate html from a md file # generate html from a md file
out/%.html: src/%.md page.tmpl out/%.html: src/%.md page.tmpl
$(PANDOC) --template page.tmpl "$<" -o "$@" $(MD2HTML) --template page.tmpl "$<" -o "$@"
# regenerate html whenever an md file changes # regenerate html whenever an md file changes
html-auto auto: html-auto auto: