summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2016-07-04 18:15:51 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2016-07-04 18:59:26 +0200
commit77c4b12eec6a932bfbf5d5decc81adda277d21bf (patch)
tree0687a8d768c1dde5e274784ec0277ea04f12b4b9
parentfc466638089998071961f152c041c1d9c79cd17d (diff)
downloadmutti-web-77c4b12eec6a932bfbf5d5decc81adda277d21bf.tar.gz
mutti-web-77c4b12eec6a932bfbf5d5decc81adda277d21bf.tar.bz2
mutti-web-77c4b12eec6a932bfbf5d5decc81adda277d21bf.zip
Add a rule to generate html files from xhtml
-rw-r--r--Makefile28
-rw-r--r--xsl/convert-xhtml-to-html.xsl23
2 files changed, 39 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index a58119f..6d5d189 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,14 @@
suffix = xhtml
version = $(shell git rev-parse --short HEAD)
-xsltproc=xsltproc --stringparam suffix .$(suffix) --stringparam stylesheet style.min.css --stringparam version $(version)
+xsltproc=xsltproc --stringparam stylesheet style.min.css --stringparam version $(version)
svg2png=rsvg-convert -f png
+fix_doctype=sed 's/ SYSTEM "about:legacy-compat"//'
pages=$(shell xsltproc xsl/main_filenames.xsl main.xml)
pages_gen=$(pages:%.xml=%.$(suffix))
+pages_gen_html=$(pages:%.xml=%.html)
common_depend=main.xml $(wildcard xsl/*.xsl) Makefile checkmark.svg
@@ -25,24 +27,26 @@ V_CSS = $(v_css_$(V))
v_css_ = $(v_css_$(DEFAULT_VERBOSITY))
v_css_0 = @echo " CSS " $@;
-V_SED = $(v_sed_$(V))
-v_sed_ = $(v_sed_$(DEFAULT_VERBOSITY))
-v_sed_0 = @echo " SED " $@;
-
-.PHONY: all
+.PHONY: all html
all: $(pages_gen) checkmark.png style/style.min.css
+html: $(pages_gen_html)
+
%.png: %.svg
$(V_GEN) $(svg2png) $< > $@
-%$(suffix): %.xml %.xsl $(common_depend)
- $(V_XSLT) $(xsltproc) $< > $@
- $(V_SED) sed -i 's/ SYSTEM "about:legacy-compat"//' $@
+%.$(suffix): %.xml %.xsl $(common_depend)
+ $(V_XSLT) $(xsltproc) --stringparam suffix .$(suffix) $< | $(fix_doctype) > $@
+
+%.$(suffix): %.xml $(common_depend)
+ $(V_XSLT) $(xsltproc) --stringparam suffix .$(suffix) $< | $(fix_doctype) > $@
+
+%.html: %.xml %.xsl $(common_depend)
+ $(V_XSLT) $(xsltproc) --stringparam suffix .html $< | $(fix_doctype) | xsltproc xsl/convert-xhtml-to-html.xsl - | $(fix_doctype) > $@
-%$(suffix): %.xml $(common_depend)
- $(V_XSLT) $(xsltproc) $< > $@
- $(V_SED) sed -i 's/ SYSTEM "about:legacy-compat"//' $@
+%.html: %.xml $(common_depend)
+ $(V_XSLT) $(xsltproc) --stringparam suffix .html $< | $(fix_doctype) | xsltproc xsl/convert-xhtml-to-html.xsl - | $(fix_doctype) > $@
style/style.min.css: style/style.css node_modules/.bin/postcss
$(V_CSS) node_modules/.bin/postcss -u postcss-css-variables style/style.css | node_modules/.bin/cleancss > style/style.min.css
diff --git a/xsl/convert-xhtml-to-html.xsl b/xsl/convert-xhtml-to-html.xsl
new file mode 100644
index 0000000..54a651b
--- /dev/null
+++ b/xsl/convert-xhtml-to-html.xsl
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0"
+ exclude-result-prefixes="html xlink svg"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:svg="http://www.w3.org/2000/svg">
+
+ <xsl:output method="html" indent="yes" encoding="utf-8"
+ cdata-section-elements="script style"
+ media-type="text/html"
+ doctype-system="about:legacy-compat"
+ />
+
+ <xsl:template match="*">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates />
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>