diff --git a/Makefile b/Makefile
index be7e1853..58b44132 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,14 @@
# Dependencies:
-# sudo apt-get install python3-pip
+# sudo apt-get install python3-pip pandoc
# sudo pip3 install rst2html5
.PHONY: all all-zips protocol
all-zips: .Makefile.uptodate
- find . -name 'zip-*.rst' |sort >.zipfilelist.new
+ find . -name 'zip-*.rst' -o -name 'zip-*.md' |sort >.zipfilelist.new
diff .zipfilelist.current .zipfilelist.new || cp -f .zipfilelist.new .zipfilelist.current
rm -f .zipfilelist.new
$(MAKE) README.rst
- $(MAKE) index.html $(addsuffix .html,$(filter-out README,$(basename $(wildcard *.rst))))
+ $(MAKE) index.html $(addsuffix .html,$(filter-out README,$(basename $(wildcard *.rst) $(wildcard *.md))))
all: all-zips protocol
@@ -22,7 +22,13 @@ protocol: .Makefile.uptodate
define PROCESSRST
$(eval TITLE := $(shell echo '$(basename $<)' | sed -E 's|zip-0{0,3}|ZIP |;s|draft-|Draft |')$(shell grep -E '^(\.\.)?\s*Title: ' $< |sed -E 's|.*Title||'))
rst2html5 -v --title="$(TITLE)" $< >$@
-./edithtml.sh $@
+./edithtml.sh --rst $@
+endef
+
+define PROCESSMD
+$(eval TITLE := $(shell echo '$(basename $<)' | sed -E 's|zip-0{0,3}|ZIP |;s|draft-|Draft |')$(shell grep -E '^(\.\.)?\s*Title: ' $< |sed -E 's|.*Title||'))
+pandoc --from=markdown --to=html $< --output=$@
+./edithtml.sh --md $@ "${TITLE}"
endef
index.html: README.rst edithtml.sh
@@ -31,9 +37,12 @@ index.html: README.rst edithtml.sh
%.html: %.rst edithtml.sh
$(PROCESSRST)
-README.rst: .zipfilelist.current makeindex.sh README.template $(wildcard zip-*.rst)
+%.html: %.md edithtml.sh
+ $(PROCESSMD)
+
+README.rst: .zipfilelist.current makeindex.sh README.template $(wildcard zip-*.rst) $(wildcard zip-*.md)
./makeindex.sh | cat README.template - >README.rst
.PHONY: clean
clean:
- rm -f .zipfilelist.* README.rst index.html $(addsuffix .html,$(basename $(wildcard *.rst)))
+ rm -f .zipfilelist.* README.rst index.html $(addsuffix .html,$(basename $(wildcard *.rst) $(wildcard *.md)))
diff --git a/edithtml.sh b/edithtml.sh
index 64759253..7309b915 100755
--- a/edithtml.sh
+++ b/edithtml.sh
@@ -1,11 +1,37 @@
-#!/bin/sh
+#!/bin/bash
-sed -i.sedbak 's|||' $@
-sed -i.sedbak 's|||g' $@
-sed -i.sedbak 's|http://cdn.mathjax.org/mathjax/latest/MathJax.js|https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js|' $@
+if [ "$1" != "--rst" -o $# -ne 2 ] && [ "$1" != "--md" -o $# -ne 3 ]; then
+ echo "Usage: edithtml.sh --rst "
+ echo " or: edithtml.sh --md "
+ exit
+fi
-# First put and ... on the same line.
-sed -i.sedbak -n '$!N;s|