diff --git a/packages/gendoc/Makefile b/packages/gendoc/Makefile index eac85af644d9c0553c2e3d9ac366c564b98d7c91..479b2e27d657aa2810d87e639f6b468bbed2eabd 100644 --- a/packages/gendoc/Makefile +++ b/packages/gendoc/Makefile @@ -8,29 +8,9 @@ $(addprefix Welcome-, Linux Darwin MINGW) markdown = $(addsuffix .md, $(targets)) html = $(addsuffix .html, $(targets)) -# Note: This requires special tools (pandoc, awk). +# Note: This requires special tools (python-markdown, awk). all: html -# Check for the official Pandoc package on Windows, so that make will find it. -ifneq (,$(wildcard /c/Program\ Files/Pandoc/pandoc.exe)) -pandoc = /c/Program\ Files/Pandoc/pandoc -else -pandoc = pandoc -endif - -# NOTE: In pandoc 2.19, --self-contained, which forces the css to be included -# in the html output, is deprecated in favour of --embed-resources. But the -# new option isn't supported in pandoc 2.18, which is still being used a -# lot. Brilliant. For now we just live with the deprecation warning. You can -# always set different options using the self-contained variable from the -# command line if needed. - -# >=2.19: -#self-contained = --standalone --embed-resources - -# <=2.18: -self-contained = --self-contained - markdown: $(markdown) html: $(html) @@ -39,16 +19,20 @@ ReadMe-%.md: ReadMe.md awk -f gendoc.awk osname="$(osname)" version="$(version)" build_version="$(build_version)" < $< > $@ ReadMe-%.html: osname = $(patsubst ReadMe-%.html,%,$@) -ReadMe-%.html: ReadMe-%.md - $(pandoc) $< -o $@ -M pagetitle="Purr Data $(version) ($(osname))" $(self-contained) --css gh-pandoc.css +ReadMe-%.html: ReadMe-%.md pandoc-template.html + python -m markdown $< > ReadMe-body.html + sed -e "s/@version@/$(version) ($(osname))/g" -e '/--stylesheet--/r gh-pandoc.css' -e '/--body--/r ReadMe-body.html' pandoc-template.html > $@ + rm -f ReadMe-body.html Welcome-%.md: osname = $(patsubst Welcome-%.md,%,$@) Welcome-%.md: Welcome.md awk -f gendoc.awk osname="$(osname)" version="$(version)" build_version="$(build_version)" < $< > $@ Welcome-%.html: osname = $(patsubst Welcome-%.html,%,$@) -Welcome-%.html: Welcome-%.md - $(pandoc) $< -o $@ -M pagetitle="Purr Data $(version) ($(osname))" $(self-contained) --css gh-pandoc.css +Welcome-%.html: Welcome-%.md pandoc-template.html + python -m markdown $< > Welcome-body.html + sed -e "s/@version@/$(version) ($(osname))/g" -e '/--stylesheet--/r gh-pandoc.css' -e '/--body--/r Welcome-body.html' pandoc-template.html > $@ + rm -f Welcome-body.html clean: rm -f $(markdown) $(html) diff --git a/packages/gendoc/pandoc-template.html b/packages/gendoc/pandoc-template.html new file mode 100644 index 0000000000000000000000000000000000000000..520f57d9dbce5d013db98ddb4e27b486ec7ccec3 --- /dev/null +++ b/packages/gendoc/pandoc-template.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html xmlns="http://www.w3.org/1999/xhtml" lang xml:lang> +<head> + <meta charset="utf-8" /> + <meta name="generator" content="pandoc" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" /> + <title>Purr Data @version@</title> + <style> + code{white-space: pre-wrap;} + span.smallcaps{font-variant: small-caps;} + span.underline{text-decoration: underline;} + div.column{display: inline-block; vertical-align: top; width: 50%;} + div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} + ul.task-list{list-style: none;} + .display.math{display: block; text-align: center; margin: 0.5rem auto;} + </style> + <style type="text/css"> +<!--stylesheet--> +</style> + <!--[if lt IE 9]> + <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script> + <![endif]--> +</head> +<body> +<!--body--> +</body> +</html>