║│ │║
║│ • cat │║
║│ • cp │║
+║│ • date │║
║│ • echo │║
║│ • file │║
║│ • find │║
║│ • rm │║
║│ • sed │║
║│ • sleep │║
+║│ • stat │║
║│ • test │║
║│ • touch │║
║│ • tr (requires support for `-d´) │║
# different implementation, you can override the appropriate variable.
CAT := cat
CP := cp
+DATE := date
ECHO := echo
FILE := file
FIND := find
RM := rm
SED := sed
SLEEP := sleep
+STAT := stat
TEST := test
TOUCH := touch
TR := tr
$(call compiled,$(compilablefiles)): $(BUILDDIR)/public/%: $$(call parsed,$(SRCDIR)/%) $(BUILDDIR)/transform.xslt $$(call parsed,$$(call dependencies,$(SRCDIR)/%))
$(silent)$(call ensuredirectory,$(dir $@))
@$(PRINTF) '%s\n' $(call quote,Compiling `$*´…)
- $(silent)$(XSLTPROC) -o $(call quote,$@) --stringparam catalog 'catalog' $(call quote,$(BUILDDIR)/transform.xslt) $(call quote,$<)
+ $(silent)$(XSLTPROC) -o $(call quote,$@) --stringparam catalog 'catalog' --stringparam buildtime '$(shell TZ= $(DATE) '+%Y-%m-%dT%H:%M:%SZ')' --stringparam srctime '$(shell TZ= $(STAT) -f '%Sm' -t '%Y-%m-%dT%H:%M:%SZ' $(call quote,$(SRCDIR)/$*))' --stringparam path $(call quote,/$*) $(call quote,$(BUILDDIR)/transform.xslt) $(call quote,$<)
$(call compiled,$(filter $(assetfiles),$(sourcefiles))): $(BUILDDIR)/public/%: $(SRCDIR)/%
@$(PRINTF) '%s\n' $(call quote,Compiling `$*´…)
$(silent)$(call ensuredirectory,$(dir $@))
- `cat`
- `cp`
+- `date`
- `echo`
- `file`
- `find`
- `rm`
- `sed`
- `sleep`
+- `stat`
- `test`
- `touch`
- `tr` (requires support for `-d`)
- Set `@exclude-result-prefixes` on the root `xslt:transform` element
to reduce the number of declared namespaces in the final result.
+The params `$buildtime`, `$srctime`, and `$path` are available within
+ transforms and are initialized to the current time, the time that the
+ source file was last modified, and the path of the output file within
+ $(DESTDIR).
+
## Output Wrapping
⛩️📰 书社 will wrap the final output of the transforms in appropriate
<namespace-alias stylesheet-prefix="xslt" result-prefix="#default"/>
<template match="/">
<xslt:transform exclude-result-prefixes="catalog exsl exslstr" version="1.0">
+ <xslt:param name="buildtime" select="'1972-12-31T00:00:00Z'"/>
<xslt:param name="catalog" select="'catalog'"/>
+ <xslt:param name="srctime" select="'1972-12-31T00:00:00Z'"/>
+ <xslt:param name="path" select="'/unknown'"/>
<xslt:variable name="书社:expansion">
<xslt:apply-templates select="/" mode="书社:expand"/>
</xslt:variable>
<xslt:copy-of select="html:html/@*"/>
<html:head>
<xslt:copy-of select="html:html/html:head/@*"/>
+ <html:script type="text/plain">
+ <xslt:text>buildtime=</xslt:text><xslt:value-of select="$buildtime"/><xslt:text>
</xslt:text>
+ <xslt:text>srctime=</xslt:text><xslt:value-of select="$srctime"/><xslt:text>
</xslt:text>
+ <xslt:text>path=</xslt:text><xslt:value-of select="$path"/><xslt:text>
</xslt:text>
+ </html:script>
<html:title>
<xslt:for-each select="exsl:node-set($metadata)/html:title">
<xslt:value-of select="."/>