Skip to content
Snippets Groups Projects
Commit 9bf65e1f authored by Albert Gräf's avatar Albert Gräf
Browse files

Switch from pandoc to python-markdown + sed.

parent aa965d2f
No related branches found
No related tags found
1 merge request!835Add document generation for ReadMe.html and Welcome.html
...@@ -8,29 +8,9 @@ $(addprefix Welcome-, Linux Darwin MINGW) ...@@ -8,29 +8,9 @@ $(addprefix Welcome-, Linux Darwin MINGW)
markdown = $(addsuffix .md, $(targets)) markdown = $(addsuffix .md, $(targets))
html = $(addsuffix .html, $(targets)) html = $(addsuffix .html, $(targets))
# Note: This requires special tools (pandoc, awk). # Note: This requires special tools (python-markdown, awk).
all: html 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) markdown: $(markdown)
html: $(html) html: $(html)
...@@ -39,16 +19,20 @@ ReadMe-%.md: ReadMe.md ...@@ -39,16 +19,20 @@ ReadMe-%.md: ReadMe.md
awk -f gendoc.awk osname="$(osname)" version="$(version)" build_version="$(build_version)" < $< > $@ awk -f gendoc.awk osname="$(osname)" version="$(version)" build_version="$(build_version)" < $< > $@
ReadMe-%.html: osname = $(patsubst ReadMe-%.html,%,$@) ReadMe-%.html: osname = $(patsubst ReadMe-%.html,%,$@)
ReadMe-%.html: ReadMe-%.md ReadMe-%.html: ReadMe-%.md pandoc-template.html
$(pandoc) $< -o $@ -M pagetitle="Purr Data $(version) ($(osname))" $(self-contained) --css gh-pandoc.css 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: osname = $(patsubst Welcome-%.md,%,$@)
Welcome-%.md: Welcome.md Welcome-%.md: Welcome.md
awk -f gendoc.awk osname="$(osname)" version="$(version)" build_version="$(build_version)" < $< > $@ awk -f gendoc.awk osname="$(osname)" version="$(version)" build_version="$(build_version)" < $< > $@
Welcome-%.html: osname = $(patsubst Welcome-%.html,%,$@) Welcome-%.html: osname = $(patsubst Welcome-%.html,%,$@)
Welcome-%.html: Welcome-%.md Welcome-%.html: Welcome-%.md pandoc-template.html
$(pandoc) $< -o $@ -M pagetitle="Purr Data $(version) ($(osname))" $(self-contained) --css gh-pandoc.css 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: clean:
rm -f $(markdown) $(html) rm -f $(markdown) $(html)
<!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>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment