]> Lady’s Gitweb - Shushe/commitdiff
Replace GENERATOR and VERSION with THISREV
authorLady <redacted>
Tue, 6 Feb 2024 03:56:03 +0000 (22:56 -0500)
committerLady <redacted>
Tue, 6 Feb 2024 03:56:03 +0000 (22:56 -0500)
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`.

GNUmakefile
README.markdown
lib/catalog2parser.xslt
lib/catalog2transform.xslt

index 5f55e1aa5b0d418cbcf96f1f554fb6fddb6b9710..f0c9e8a1ab5745b0d652e05eb1f6060c4f0fa53b 100644 (file)
@@ -168,13 +168,10 @@ TRANSFORMS := $(sort $(patsubst ./%,%,$(wildcard $(THISDIR)/transforms/*.xslt))
 # 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),)
@@ -500,7 +497,7 @@ $(BUILDDIR)/parser.xslt : $(BUILDDIR)/parser.catalog $(THISDIR)/lib/catalog2pars
 $(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.
 #
@@ -536,7 +533,7 @@ $(BUILDDIR)/transform.xslt : $(BUILDDIR)/transform.catalog $(THISDIR)/lib/catalo
 $(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 $@))
index 885fe751dcd580ec353e52d2c1162f2eab7df1bd..6b4f06ed18627a3a8dc344f94b5595b74bb85ba3 100644 (file)
@@ -214,11 +214,8 @@ The following additional variables can be used to control the behaviour
   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`:**
@@ -454,17 +451,14 @@ The following params are made available globally in parsers and
 - **`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 :⁠—
 
index 779157060dc8900ae0c707c6436f469525f1f4cc..4ea7bda48a5f95e5ea2cd8640172f79d346cef43 100644 (file)
@@ -24,10 +24,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                <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">
index 5b7183e725418654b034c175be01b19677ebde7e..a6c83d6ef9e1e9300c43695657659688d5904f64 100644 (file)
@@ -28,11 +28,10 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                        <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>
@@ -53,9 +52,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                        <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()"/>
@@ -132,9 +131,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                        <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/@*"/>
@@ -156,18 +155,20 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                        </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/@*"/>
This page took 0.06924 seconds and 4 git commands to generate.