]> Lady’s Gitweb - Shrine-XSLT/commitdiff
Allow custom `YIELD` script for yielding sources
authorLady <redacted>
Thu, 26 Jan 2023 05:12:35 +0000 (21:12 -0800)
committerLady <redacted>
Sat, 29 Apr 2023 03:07:11 +0000 (20:07 -0700)
By default, this is just `cat`, which will simply pipe the source
content into the transformation, but one might change this to be
`cat doctype.dtd`, for example, to add a doctype to the beginning of
every source file, or a more complicated script.

`YIELD_DEPENDENCIES` can be used to specify dependencies of the `YIELD`
script to ensure the files are rebuilt when a dependency changes.

GNUmakefile

index 7f20dea36fa87d58640751d0b04d03ef7c7e324c..fd272ee23e55d059e145d69b0d4c4c27a905dcd3 100644 (file)
@@ -26,10 +26,12 @@ SOURCE_EXT = .xml
 TRANSFORM = transform.xslt
 XSLT = xsltproc
 XSLTOPTS =
+YIELD = cat
+YIELD_DEPENDENCIES =
 
 headers := $(wildcard *-header.xml)
 footers := $(wildcard *-footer.xml)
-override prerequisites := $(TRANSFORM) $(headers) $(footers)
+override prerequisites := $(YIELD_DEPENDENCIES) template.xml $(TRANSFORM) $(headers) $(footers)
 
 override indexsources := $(wildcard sources/index$(SOURCE_EXT) sources/index-*$(SOURCE_EXT))
 override indices := $(patsubst sources/%$(SOURCE_EXT),public/%.html,$(indexsources))
@@ -54,7 +56,8 @@ override content := $(indices) $(pages)
 # • Removes any doctype for root elements other than `html` (with `grep -v`).
 #
 # • Saves the output to `$(2)`.
-override makexslt = $(XSLT) --nonet --novalid $(XSLTOPTS) --stringparam BASEIRI "$(BASEIRI)" --stringparam DATETIME "$(DATETIME)" --stringparam OUTPUTPATH "$(patsubst public/%,/%,$(2))" transform.xslt $(1)\
+override makexslt = $(YIELD) $(1)\
+       | $(XSLT) --nonet --novalid $(XSLTOPTS) --stringparam BASEIRI "$(BASEIRI)" --stringparam DATETIME "$(DATETIME)" --stringparam OUTPUTPATH "$(patsubst public/%,/%,$(2))" transform.xslt -\
        $(if $(filter %.html,$(2)),| sed 's/ xmlns:[0-9A-Za-z_-]*="[^"]*"//g',)\
        | grep -v '^<!DOCTYPE \([^h]\|.[^t]\|..[^m]\|...[^l]\|....[^ >]\)'\
        > $(2)
This page took 0.023158 seconds and 4 git commands to generate.