From ec83b34a8f2ab92966ecbfc196245f5965306484 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 5 Jul 2016 08:54:53 +0200 Subject: Allow to use different resource caching schemes On the deployment server we no use make versioned_jpg="'s/.*/.&.jpg/'" versioned_png="'s/.*/.&.png/'" to generate resource urls like image.f74d4ea.png --- Makefile | 20 +++++++++++++------- xsl/common.xsl | 3 +++ xsl/img.xsl | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- xsl/layout.xsl | 8 ++++---- 4 files changed, 68 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 8bfe4c6..ff356b5 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,13 @@ -suffix = xhtml +suffix = .xhtml +link_suffix = $(suffix) version = $(shell git rev-parse --short HEAD) -xsltproc=xsltproc --stringparam stylesheet "$(shell cat style/style.min.css)" --stringparam version $(version) +versioned_jpg = 's/.*/.jpg?&/' +versioned_png = 's/.*/.png?&/' + +version_args = --stringparam versioned_jpg $(shell echo $(version) | sed $(versioned_jpg)) --stringparam versioned_png $(shell echo $(version) | sed $(versioned_png)) + +xsltproc=xsltproc --stringparam stylesheet "$(shell cat style/style.min.css)" --stringparam version $(version) $(version_args) svg2png=rsvg-convert -f png fix_doctype=sed 's/ SYSTEM "about:legacy-compat"//' @@ -9,7 +15,7 @@ to_html=$(fix_doctype) | xsltproc xsl/convert-xhtml-to-html.xsl - | $(fix_doctyp pages=$(shell xsltproc xsl/main_filenames.xsl main.xml) -pages_gen=$(pages:%.xml=%.$(suffix)) +pages_gen=$(pages:%.xml=%$(suffix)) pages_gen_html=$(pages:%.xml=%.html) common_depend=main.xml $(wildcard xsl/*.xsl) Makefile checkmark.svg style/style.min.css @@ -38,11 +44,11 @@ html: $(pages_gen_html) %.png: %.svg $(V_GEN) $(svg2png) $< > $@ -%.$(suffix): %.xml %.xsl $(common_depend) - $(V_XSLT) $(xsltproc) --stringparam suffix .$(suffix) $< | $(fix_doctype) > $@ +%$(suffix): %.xml %.xsl $(common_depend) + $(V_XSLT) $(xsltproc) --stringparam suffix $(link_suffix) $< | $(fix_doctype) > $@ -%.$(suffix): %.xml $(common_depend) - $(V_XSLT) $(xsltproc) --stringparam suffix .$(suffix) $< | $(fix_doctype) > $@ +%$(suffix): %.xml $(common_depend) + $(V_XSLT) $(xsltproc) --stringparam suffix $(link_suffix) $< | $(fix_doctype) > $@ %.html: %.xml %.xsl $(common_depend) $(V_XSLT) $(xsltproc) --stringparam suffix .html $< | $(to_html) > $@ diff --git a/xsl/common.xsl b/xsl/common.xsl index 0b7eefc..007d8a2 100644 --- a/xsl/common.xsl +++ b/xsl/common.xsl @@ -19,6 +19,9 @@ + + + - - ? - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xsl/layout.xsl b/xsl/layout.xsl index 7b0a4c9..21d466d 100644 --- a/xsl/layout.xsl +++ b/xsl/layout.xsl @@ -48,7 +48,7 @@

- +
@@ -65,14 +65,14 @@