summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
inline | side by side (from parent 1:
662456c)
Instead of replacing existing `<html:meta name="generator">`s, format
them into a comma‐separated list with ⛩️📰 书社 as the final entry.
Don’t allow overriding of ⛩️📰 书社 generator metadata.
Manually specifying `THISREV` is still possible to allow it to be
filled by users running Make without Git, but it should not be
overridden with the version of the calling generator, as it is used to
fill `@书社:version`.
# List of types which should be treated as X·M·L.
XMLTYPES := application/xml text/xml
# List of types which should be treated as X·M·L.
XMLTYPES := application/xml text/xml
-# The name of the generator program.
-GENERATOR := ⛩️📰 书社
-
ifdef GIT
ifneq ($(wildcard $(THISDIR)/.git),)
# A description of the current git revision of ⛩️📰 书社.
ifdef GIT
ifneq ($(wildcard $(THISDIR)/.git),)
# A description of the current git revision of ⛩️📰 书社.
-VERSION := $(shell cd $(THISDIR); $(GIT) describe 2> /dev/null || $(GIT) rev-parse HEAD 2> /dev/null || true)
+THISREV := $(shell cd $(THISDIR); $(GIT) describe 2> /dev/null || $(GIT) rev-parse HEAD 2> /dev/null || true)
endif
ifneq ($(wildcard .git),)
endif
ifneq ($(wildcard .git),)
$(call parsed,$(sourcefiles) $(sourceincludes)) : % : $$(call unparsed,$$@) $(BUILDDIR)/parser.xslt $(typeupdates)
@$(PRINTF) '%s\n' $(call quote,Processing `$<´…)
$(silent)$(call ensuredirectory,$(dir $@))
$(call parsed,$(sourcefiles) $(sourceincludes)) : % : $$(call unparsed,$$@) $(BUILDDIR)/parser.xslt $(typeupdates)
@$(PRINTF) '%s\n' $(call quote,Processing `$<´…)
$(silent)$(call ensuredirectory,$(dir $@))
- $(silent)$(if $(filter $<,$(assetfiles)),$(PRINTF) '%s\n' $(call quote,<object xmlns="http://www.w3.org/1999/xhtml" type="$(call typeoffile,$<)" data="$(call datauri,$<)"/>) > $(call quote,$@),$(if $(filter $<,$(plaintextfiles)),$(call wrapplaintext,$<),$(CAT) $(call quote,$<)) | $(XSLTPROC) -o $(call quote,$@) --stringparam BUILDTIME $$(TZ= $(DATE) '+%Y-%m-%dT%H:%M:%SZ') --stringparam SRCTIME $$(TZ= $(STAT) -f '%Sm' -t '%Y-%m-%dT%H:%M:%SZ' $(call quote,$<)) --stringparam CKSUM $$($(CKSUM) $(call quote,$<) | $(SED) 's/[ ].*//')$(if $(GENERATOR), --stringparam GENERATOR $(call quote,$(GENERATOR)))$(if $(VERSION), --stringparam VERSION $(call quote,$(VERSION)),)$(if $(SRCREV), --stringparam SRCREV $(call quote,$(SRCREV)),) $(call quote,$(BUILDDIR)/parser.xslt) -)
+ $(silent)$(if $(filter $<,$(assetfiles)),$(PRINTF) '%s\n' $(call quote,<object xmlns="http://www.w3.org/1999/xhtml" type="$(call typeoffile,$<)" data="$(call datauri,$<)"/>) > $(call quote,$@),$(if $(filter $<,$(plaintextfiles)),$(call wrapplaintext,$<),$(CAT) $(call quote,$<)) | $(XSLTPROC) -o $(call quote,$@) --stringparam BUILDTIME $$(TZ= $(DATE) '+%Y-%m-%dT%H:%M:%SZ') --stringparam SRCTIME $$(TZ= $(STAT) -f '%Sm' -t '%Y-%m-%dT%H:%M:%SZ' $(call quote,$<)) --stringparam CKSUM $$($(CKSUM) $(call quote,$<) | $(SED) 's/[ ].*//')$(if $(THISREV), --stringparam THISREV $(call quote,$(THISREV)),)$(if $(SRCREV), --stringparam SRCREV $(call quote,$(SRCREV)),) $(call quote,$(BUILDDIR)/parser.xslt) -)
# Generate a catalog of all parsed files, for use when processing includes.
#
# Generate a catalog of all parsed files, for use when processing includes.
#
$(call compiled,$(compilablefiles)) : $(BUILDDIR)/public/% : $$(call parsed,$$(call uncompiled,$$@)) $(BUILDDIR)/transform.xslt $$(call parsed,$$(call dependencies,$$(call uncompiled,$$@)))
$(silent)$(call ensuredirectory,$(dir $@))
@$(PRINTF) '%s\n' $(call quote,Compiling </$*>…)
$(call compiled,$(compilablefiles)) : $(BUILDDIR)/public/% : $$(call parsed,$$(call uncompiled,$$@)) $(BUILDDIR)/transform.xslt $$(call parsed,$$(call dependencies,$$(call uncompiled,$$@)))
$(silent)$(call ensuredirectory,$(dir $@))
@$(PRINTF) '%s\n' $(call quote,Compiling </$*>…)
- $(silent)$(XSLTPROC) -o $(call quote,$@) --stringparam CATALOG 'catalog' --stringparam BUILDTIME $$(TZ= $(DATE) '+%Y-%m-%dT%H:%M:%SZ') --stringparam SRCTIME $$(TZ= $(STAT) -f '%Sm' -t '%Y-%m-%dT%H:%M:%SZ' $(call quote,$(call uncompiled,$@))) --stringparam PATH $(call quote,/$*) --stringparam CKSUM $$($(CKSUM) $(call quote,$(call uncompiled,$@)) | $(SED) 's/[ ].*//')$(if $(GENERATOR), --stringparam GENERATOR $(call quote,$(GENERATOR)))$(if $(VERSION), --stringparam VERSION $(call quote,$(VERSION)),)$(if $(SRCREV), --stringparam SRCREV $(call quote,$(SRCREV)),) $(call quote,$(BUILDDIR)/transform.xslt) $(call quote,$<)
+ $(silent)$(XSLTPROC) -o $(call quote,$@) --stringparam CATALOG 'catalog' --stringparam BUILDTIME $$(TZ= $(DATE) '+%Y-%m-%dT%H:%M:%SZ') --stringparam SRCTIME $$(TZ= $(STAT) -f '%Sm' -t '%Y-%m-%dT%H:%M:%SZ' $(call quote,$(call uncompiled,$@))) --stringparam PATH $(call quote,/$*) --stringparam CKSUM $$($(CKSUM) $(call quote,$(call uncompiled,$@)) | $(SED) 's/[ ].*//')$(if $(THISREV), --stringparam THISREV $(call quote,$(THISREV)),)$(if $(SRCREV), --stringparam SRCREV $(call quote,$(SRCREV)),) $(call quote,$(BUILDDIR)/transform.xslt) $(call quote,$<)
$(call compiled,$(filter $(assetfiles),$(sourcefiles))) : $(BUILDDIR)/public/% : $$(call uncompiled,$$@)
@$(PRINTF) '%s\n' $(call quote,Compiling </$*>…)
$(silent)$(call ensuredirectory,$(dir $@))
$(call compiled,$(filter $(assetfiles),$(sourcefiles))) : $(BUILDDIR)/public/% : $$(call uncompiled,$$@)
@$(PRINTF) '%s\n' $(call quote,Compiling </$*>…)
$(silent)$(call ensuredirectory,$(dir $@))
A white·space‐separated list of media types to consider X·M·L
(default: `application/xml text/xml`).
A white·space‐separated list of media types to consider X·M·L
(default: `application/xml text/xml`).
-- **`GENERATOR`:**
- The name of the generator program (default: `⛩️📰 书社`).
-
-- **`VERSION`:**
- The current version of `GENERATOR` (default: derived from the current
+- **`THISREV`:**
+ The current version of ⛩️📰 书社 (default: derived from the current
git tag/branch/commit).
- **`SRCREV`:**
git tag/branch/commit).
- **`SRCREV`:**
- **`CKSUM`:**
The checksum of the source file (⅌ `cksum`).
- **`CKSUM`:**
The checksum of the source file (⅌ `cksum`).
-- **`GENERATOR`:**
- The value of the `GENERATOR` variable (if present).
-
- **`SRCREV`:**
The value of the `SRCREV` variable (if present).
- **`SRCTIME`:**
The time at which the source file was last modified.
- **`SRCREV`:**
The value of the `SRCREV` variable (if present).
- **`SRCTIME`:**
The time at which the source file was last modified.
-- **`VERSION`:**
- The value of the `VERSION` variable (if present).
+- **`THISREV`:**
+ The value of the `THISREV` variable (if present).
The following params are only available in transforms :—
The following params are only available in transforms :—
<xslt:transform version="1.0">
<xslt:param name="BUILDTIME" select="'1972-12-31T00:00:00Z'"/>
<xslt:param name="CKSUM" select="false"/>
<xslt:transform version="1.0">
<xslt:param name="BUILDTIME" select="'1972-12-31T00:00:00Z'"/>
<xslt:param name="CKSUM" select="false"/>
- <xslt:param name="GENERATOR" select="false"/>
<xslt:param name="SRCREV" select="false"/>
<xslt:param name="SRCTIME" select="'1972-12-31T00:00:00Z'"/>
<xslt:param name="SRCREV" select="false"/>
<xslt:param name="SRCTIME" select="'1972-12-31T00:00:00Z'"/>
- <xslt:param name="VERSION" select="false"/>
+ <xslt:param name="THISREV" select="false"/>
<xslt:variable name="书社:parsers">
<html:dl>
<for-each select="//catalog:uri">
<xslt:variable name="书社:parsers">
<html:dl>
<for-each select="//catalog:uri">
<xslt:param name="BUILDTIME" select="'1972-12-31T00:00:00Z'"/>
<xslt:param name="CKSUM" select="false"/>
<xslt:param name="CATALOG" select="'catalog'"/>
<xslt:param name="BUILDTIME" select="'1972-12-31T00:00:00Z'"/>
<xslt:param name="CKSUM" select="false"/>
<xslt:param name="CATALOG" select="'catalog'"/>
- <xslt:param name="GENERATOR" select="false"/>
<xslt:param name="PATH" select="'/unknown'"/>
<xslt:param name="SRCREV" select="false"/>
<xslt:param name="SRCTIME" select="'1972-12-31T00:00:00Z'"/>
<xslt:param name="PATH" select="'/unknown'"/>
<xslt:param name="SRCREV" select="false"/>
<xslt:param name="SRCTIME" select="'1972-12-31T00:00:00Z'"/>
- <xslt:param name="VERSION" select="false"/>
+ <xslt:param name="THISREV" select="false"/>
<xslt:variable name="书社:expansion">
<xslt:apply-templates select="/" mode="书社:expand"/>
</xslt:variable>
<xslt:variable name="书社:expansion">
<xslt:apply-templates select="/" mode="书社:expand"/>
</xslt:variable>
<xslt:when test="exsl:node-set($书社:result)/*[@书社:disable-output-wrapping]">
<xslt:for-each select="exsl:node-set($书社:result)/*">
<xslt:copy>
<xslt:when test="exsl:node-set($书社:result)/*[@书社:disable-output-wrapping]">
<xslt:for-each select="exsl:node-set($书社:result)/*">
<xslt:copy>
- <xslt:if test="$VERSION">
+ <xslt:if test="$THISREV">
<xslt:attribute name="书社:version">
<xslt:attribute name="书社:version">
- <xslt:value-of select="$VERSION"/>
+ <xslt:value-of select="$THISREV"/>
</xslt:attribute>
</xslt:if>
<xslt:copy-of select="@*[not(namespace-uri()='&书社;' and contains('disable-output-wrapping version', local-name()))]|node()"/>
</xslt:attribute>
</xslt:if>
<xslt:copy-of select="@*[not(namespace-uri()='&书社;' and contains('disable-output-wrapping version', local-name()))]|node()"/>
<xslt:apply-templates select="exsl:node-set($modalinput)" mode="书社:metadata"/>
</xslt:variable>
<html:html>
<xslt:apply-templates select="exsl:node-set($modalinput)" mode="书社:metadata"/>
</xslt:variable>
<html:html>
- <xslt:if test="$VERSION">
+ <xslt:if test="$THISREV">
<xslt:attribute name="书社:version">
<xslt:attribute name="书社:version">
- <xslt:value-of select="$VERSION"/>
+ <xslt:value-of select="$THISREV"/>
</xslt:attribute>
</xslt:if>
<xslt:copy-of select="html:html/@*"/>
</xslt:attribute>
</xslt:if>
<xslt:copy-of select="html:html/@*"/>
</xslt:for-each>
</html:title>
<xslt:copy-of select="exsl:node-set($metadata)/node()[not(self::*) or not(self::html:title)]"/>
</xslt:for-each>
</html:title>
<xslt:copy-of select="exsl:node-set($metadata)/node()[not(self::*) or not(self::html:title)]"/>
- <xslt:if test="$GENERATOR and not(exsl:node-set($metadata)/html:meta[@name='generator'])">
- <html:meta name="generator">
- <xslt:attribute name="content">
- <xslt:value-of select="$GENERATOR"/>
- <xslt:if test="$VERSION">
- <xslt:text> (</xslt:text>
- <xslt:value-of select="$VERSION"/>
- <xslt:text>)</xslt:text>
- </xslt:if>
- </xslt:attribute>
- </html:meta>
- </xslt:if>
+ <html:meta name="generator">
+ <xslt:attribute name="content">
+ <xslt:for-each select="exsl:node-set($metadata)/html:meta[@name='generator']">
+ <xslt:value-of select="@content"/>
+ <xslt:text>, </xslt:text>
+ </xslt:for-each>
+ <xslt:text>⛩️📰 书社</xslt:text>
+ <xslt:if test="$THISREV">
+ <xslt:text> (</xslt:text>
+ <xslt:value-of select="$THISREV"/>
+ <xslt:text>)</xslt:text>
+ </xslt:if>
+ </xslt:attribute>
+ </html:meta>
</html:head>
<html:body>
<xslt:copy-of select="html:html/html:body/@*|html:body/@*"/>
</html:head>
<html:body>
<xslt:copy-of select="html:html/html:body/@*|html:body/@*"/>