]> Lady’s Gitweb - Shushe/commitdiff
Add DATAOPTS current 1.0.1
authorLady <redacted>
Sat, 25 Jan 2025 20:09:34 +0000 (15:09 -0500)
committerLady <redacted>
Sun, 26 Jan 2025 01:40:46 +0000 (20:40 -0500)
This is a bit hacky, but probably is still the simplest and most
elegant solution to the problem of ⛩📰 书社 needing to use different
variables for different stages of a two‐stage build. Note that the core
variables used to manage the two‐stage process (`INCLUDEDIR`,
`BUILDDIR`, `FINDRULES`, `FINDINCLUDERULES`, and `MODE`) can _not_ be
overridden thru this (or any) mechanism.

This commit also adds a new callable variable, `varquote`, for escaping
dollar signs when passing them thru to submakes.

GNUmakefile
README.markdown
lib/archive2extractor.xslt
lib/catalog2transform.xslt
parsers/plain.xslt
parsers/record-jar.xslt
parsers/tsv.xslt
transforms/asset.xslt
transforms/metadata.xslt

index 3161ecd5960c3243b0a2c30c01950cf148ca1ccb..80e1c4c970d713455c9eca229227f2ff36a48a28 100644 (file)
@@ -1,4 +1,4 @@
-# SPDX-FileCopyrightText: 2023, 2024 Lady <https://www.ladys.computer/about/#lady>
+# SPDX-FileCopyrightText: 2023, 2024, 2025 Lady <https://www.ladys.computer/about/#lady>
 # SPDX-License-Identifier: MPL-2.0
 
 SHELL = /bin/sh
 # SPDX-License-Identifier: MPL-2.0
 
 SHELL = /bin/sh
@@ -188,6 +188,11 @@ EXTRAFINDINCLUDERULES :=
 FINDRULES := '!' '(' '(' -name '[.-]*' -a '!' -name '.' -o -name '*[][*?:|$$%\#\\; ]*' -o -name '*[)]' ')' -a -prune ')'$(if $(EXTRAFINDRULES), -a '(' $(EXTRAFINDRULES) ')',)
 FINDINCLUDERULES := $(FINDRULES)$(if $(EXTRAFINDINCLUDERULES), -a '(' $(EXTRAFINDINCLUDERULES) ')',)
 
 FINDRULES := '!' '(' '(' -name '[.-]*' -a '!' -name '.' -o -name '*[][*?:|$$%\#\\; ]*' -o -name '*[)]' ')' -a -prune ')'$(if $(EXTRAFINDRULES), -a '(' $(EXTRAFINDRULES) ')',)
 FINDINCLUDERULES := $(FINDRULES)$(if $(EXTRAFINDINCLUDERULES), -a '(' $(EXTRAFINDINCLUDERULES) ')',)
 
+# Options to use when calling Make for the first build of a two‐stage build.
+#
+# This can be used to override variables which are only applicable to the second build.
+DATAOPTS :=
+
 # File extensions which indicate files in `SRCDIR´ which should be built as part of the first, rather than second, stage of the two‐stage `MODE´.
 DATAEXT := rdf
 
 # File extensions which indicate files in `SRCDIR´ which should be built as part of the first, rather than second, stage of the two‐stage `MODE´.
 DATAEXT := rdf
 
@@ -197,6 +202,46 @@ DATAEXT := rdf
 EXTRAFINDDATARULES :=
 FINDDATARULES := -name '.' $(foreach ext,$(DATAEXT), -o -name '$(subst ','"'"',[!.]*.$(ext))')$(if $(EXTRAFINDDATARULES), -a '(' $(EXTRAFINDDATARULES) ')',)
 
 EXTRAFINDDATARULES :=
 FINDDATARULES := -name '.' $(foreach ext,$(DATAEXT), -o -name '$(subst ','"'"',[!.]*.$(ext))')$(if $(EXTRAFINDDATARULES), -a '(' $(EXTRAFINDDATARULES) ')',)
 
+# A semicolon‐separated list of regular expressions which paths should be required to match when finding files.
+FINDFILTERONLY :=
+
+# A semicolon‐separated list of regular expressions for paths which should be filtered out when finding files.
+FINDFILTEROUT :=
+
+# A semicolon‐separated list of regular expressions for paths which paths should be required to match when finding includes.
+#
+# This is generally only useful when `SRCDIR´ and `INCLUDEDIR´ point to the same location.
+# In that situation, this variable can be used to select certain files as includes, leaving the others to be recognized as sources instead.
+#
+# Otherwise, appropriately constructing `FINDFILTERONLY´ to look at the base directory of the files it finds should be sufficient.
+FINDINCLUDEFILTERONLY :=
+
+# A semicolon‐separated list of regular expressions for paths which should be filtered out in addition to those in `FINDFILTEROUT´ when finding includes.
+#
+# This is generally only useful when `SRCDIR´ and `INCLUDEDIR´ point to the same location.
+# In that situation, this variable can be used to exclude certain files from being recognized as includes, which will make them recognized as sources instead.
+#
+# Otherwise, appropriately constructing `FINDFILTEROUT´ to look at the base directory of the files it finds should be sufficient.
+FINDINCLUDEFILTEROUT :=
+
+# If not empty, the regular expression provided by `FINDFILTERONLY´ is an extended regular expression.
+FINDFILTERONLYEXTENDED :=
+
+# If not empty, the regular expression provided by `FINDFILTEROUT´ is an extended regular expression.
+#
+# By default, this matches `FINDFILTERONLYEXTENDED´
+FINDFILTEROUTEXTENDED :=  $(FINDFILTERONLYEXTENDED)
+
+# If not empty, the regular expression provided by `FINDFILTEROUT´ is an extended regular expression.
+#
+# By default, this matches `FINDFILTERONLYEXTENDED´
+FINDINCLUDEFILTERONLYEXTENDED :=  $(FINDFILTERONLYEXTENDED)
+
+# If not empty, the regular expression provided by `FINDINCLUDEFILTEROUT´ is an extended regular expression.
+#
+# By default, this matches `FINDFILTEROUTEXTENDED´
+FINDINCLUDEFILTEROUTEXTENDED := $(and $(FINDFILTERONLYEXTENDED),$(FINDFILTEROUTEXTENDED),1)
+
 # The list of magic files to use when determining media types.
 #
 # Some are provided as part of this repository, but you can add more if you need different media type detection.
 # The list of magic files to use when determining media types.
 #
 # Some are provided as part of this repository, but you can add more if you need different media type detection.
@@ -275,7 +320,7 @@ export LC_ALL
 
 # Posix timezone information.
 TZ := UTC0
 
 # Posix timezone information.
 TZ := UTC0
-export UTC0
+export TZ
 
 # The default target for this makefile.
 .DEFAULT_GOAL := all
 
 # The default target for this makefile.
 .DEFAULT_GOAL := all
@@ -311,6 +356,9 @@ override not = $(if $1,,1)
 # (callable) Quote the given string for use within shell calls.
 override quote = '$(subst ','"'"',$1)'
 
 # (callable) Quote the given string for use within shell calls.
 override quote = '$(subst ','"'"',$1)'
 
+# (callable) Quote the given string for use defining a variable to send to a submake.
+override varquote = $(subst $$,$$$$,$(call quote,$1))
+
 # The command to use for percent‐decoding.
 override perdeccmd := $(SED) 's/|/%7C/g;s/[\]/%5C/g;s/%[0123456789ABCDEFabcdef]\{2\}/|&|/g' | $(TR) '|' '\n' | $(SED) '/^%[0123456789ABCDEFabcdef]\{2\}$$/!s/%/|%25|/' | $(TR) '|' '\n' | $(AWK) '$$0!~/%/{printf "%s",$$0}/%/{d="0123456789ABCDEF";v=substr(toupper($$0),2,2);printf "\\%04o",(index(d,substr(v,1,1))-1)*16+index(d,substr(v,2,1))-1}' | $(SED) $(call quote,s/'/'"'"'/g;s/^/'/;s/$$/'/;$$!s/$$/\\/) | $(XARGS) -E '' $(PRINTF) '%b'
 
 # The command to use for percent‐decoding.
 override perdeccmd := $(SED) 's/|/%7C/g;s/[\]/%5C/g;s/%[0123456789ABCDEFabcdef]\{2\}/|&|/g' | $(TR) '|' '\n' | $(SED) '/^%[0123456789ABCDEFabcdef]\{2\}$$/!s/%/|%25|/' | $(TR) '|' '\n' | $(AWK) '$$0!~/%/{printf "%s",$$0}/%/{d="0123456789ABCDEF";v=substr(toupper($$0),2,2);printf "\\%04o",(index(d,substr(v,1,1))-1)*16+index(d,substr(v,2,1))-1}' | $(SED) $(call quote,s/'/'"'"'/g;s/^/'/;s/$$/'/;$$!s/$$/\\/) | $(XARGS) -E '' $(PRINTF) '%b'
 
@@ -354,7 +402,7 @@ override notbuilding := $(and $(filter help clean,$(MAKECMDGOALS)),$(call not,$(
 # If `$(notbuilding)´ is non·empty, this variable produces no result to avoid unnecessary work.
 #
 # ☡ This variable creates at least one subshell every time it is computed.
 # If `$(notbuilding)´ is non·empty, this variable produces no result to avoid unnecessary work.
 #
 # ☡ This variable creates at least one subshell every time it is computed.
-override diffprereqs = $(if $(notbuilding),,$(and $(subst $(shell $(CAT) $(call quote,$(BUILDDIR)/lastprereqs/$1) 2>>/dev/null || :),,$2),$(shell $(call ensuredirectory,$(BUILDDIR)/lastprereqs) && $(PRINTF) '%s\n' $(call quote,$2) >|$(BUILDDIR)/lastprereqs/$1),)$2 $(BUILDDIR)/lastprereqs/$1)
+override diffprereqs = $(if $(notbuilding),,$(and $(or $(wildcard $(BUILDDIR)/lastprereqs/$1),$(shell $(TOUCH) $(call quote,$(BUILDDIR)/lastprereqs/$1)),1),$(subst $(shell $(CAT) $(call quote,$(BUILDDIR)/lastprereqs/$1) 2>>/dev/null || :),,$2),$(shell $(call ensuredirectory,$(BUILDDIR)/lastprereqs) && $(PRINTF) '%s\n' $(call quote,$2) >|$(call quote,$(BUILDDIR)/lastprereqs/$1)),)$2 $(BUILDDIR)/lastprereqs/$1)
 
 # ─ ¶ Recipe Variable Definitions ─────────────────────────────────────
 
 
 # ─ ¶ Recipe Variable Definitions ─────────────────────────────────────
 
@@ -385,7 +433,7 @@ override id = $(XMLLINT) --noent --nonet --xpath '/*/*[local-name()="id" and nam
 override extracttext = $(PRINTF) '%s' '<transform xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0"><output method="text" encoding="UTF-8"/></transform>' | $(XSLTPROC) --nonet --novalid --nomkdir --nowrite - $(call quote,$1)
 
 # (callable) Process the provided transformation result and output the result to the provided location, given the provided relative path.
 override extracttext = $(PRINTF) '%s' '<transform xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0"><output method="text" encoding="UTF-8"/></transform>' | $(XSLTPROC) --nonet --novalid --nomkdir --nowrite - $(call quote,$1)
 
 # (callable) Process the provided transformation result and output the result to the provided location, given the provided relative path.
-override processresultto = if $(call xpath,/*[local-name()="raw-text" and namespace-uri()="urn:fdc:ladys.computer:20231231:Shu1She4"],$1); then $(call extracttext,$1) >|$(call quote,$2); elif $(call xpath,/*[local-name()="base64-binary" and namespace-uri()="urn:fdc:ladys.computer:20231231:Shu1She4"],$1); then { $(PRINTF) '%s\n' 'begin-base64 644 -'; $(call extracttext,$1) | $(TR) -d '\t\n\f\r '; $(PRINTF) '\n%s\n' '===='; } | $(UUDECODE) -o /dev/stdout >|$(call quote,$2); elif $(call xpath,/*[local-name()="archive" and namespace-uri()="urn:fdc:ladys.computer:20231231:Shu1She4"],$1); then $(MAKE) -f $(makefile) NAME=$(call quote,$3) SRC=$(call quote,$1) BUILDDIR=$(call quote,$(BUILDDIR)/archive/$3) DESTDIR=$(call quote,$(patsubst %/,%,$(dir $2))) MODE='urn:fdc:ladys.computer:20231231:Shu1She4:mode:archive' $(call quote,$2); else $(FINALIZE) $(call quote,$1) >|$(call quote,$2); fi
+override processresultto = if $(call xpath,/*[local-name()="raw-text" and namespace-uri()="urn:fdc:ladys.computer:20231231:Shu1She4"],$1); then $(call extracttext,$1) >|$(call quote,$2); elif $(call xpath,/*[local-name()="base64-binary" and namespace-uri()="urn:fdc:ladys.computer:20231231:Shu1She4"],$1); then { $(PRINTF) '%s\n' 'begin-base64 644 -'; $(call extracttext,$1) | $(TR) -d '\t\n\f\r '; $(PRINTF) '\n%s\n' '===='; } | $(UUDECODE) -o /dev/stdout >|$(call quote,$2); elif $(call xpath,/*[local-name()="archive" and namespace-uri()="urn:fdc:ladys.computer:20231231:Shu1She4"],$1); then $(MAKE) -f $(makefile) NAME=$(call varquote,$3) SRC=$(call varquote,$1) BUILDDIR=$(call varquote,$(BUILDDIR)/archive/$3) DESTDIR=$(call varquote,$(patsubst %/,%,$(dir $2))) MODE='urn:fdc:ladys.computer:20231231:Shu1She4:mode:archive' $(call varquote,$2); else $(FINALIZE) $(call quote,$1) >|$(call quote,$2); fi
 
 # ━ § BEGIN DEFAULT MAKE·FILE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
 
 # ━ § BEGIN DEFAULT MAKE·FILE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 
@@ -403,10 +451,10 @@ override attresc = $(subst ",&quot;,$(call xmlesc,$1))
 override sedesc = $(subst /,[/],$(subst $$,\$$,$(subst *,\*,$(subst .,\.,$(subst [,\[,$(subst ^,\^,$(subst \,\\,$1)))))))
 
 # (overridable) Collect all of the applicable includes from the includes directory.
 override sedesc = $(subst /,[/],$(subst $$,\$$,$(subst *,\*,$(subst .,\.,$(subst [,\[,$(subst ^,\^,$(subst \,\\,$1)))))))
 
 # (overridable) Collect all of the applicable includes from the includes directory.
-sourceincludes := $(if $(and $(INCLUDEDIR),$(wildcard $(INCLUDEDIR))),$(patsubst ./%,%,$(shell $(FIND) $(foreach dir,$(INCLUDEDIR),$(call quote,$(dir))) '(' $(FINDINCLUDERULES) ')' -a -type f -a -print)),)
+sourceincludes := $(foreach dir,$(INCLUDEDIR),$(and $(dir),$(wildcard $(dir)),$(patsubst ./%,%,$(shell $(FIND) $(call quote,$(dir)) '(' $(FINDINCLUDERULES) ')' -a -type f -a -print$(and $(FINDFILTERONLY),$(space)| $(GREP)$(and $(FINDFILTERONLYEXTENDED),$(space)-E) $(foreach filter,$(shell $(PRINTF) '%s\n' $(call quote,$(FINDFILTERONLY)) | $(TR) ' ;' '; '),-e $(call quote,$(subst ;, ,$(filter)))))$(and $(FINDINCLUDEFILTERONLY),$(space)| $(GREP)$(and $(FINDINCLUDEFILTERONLYEXTENDED),$(space)-E) $(foreach filter,$(shell $(PRINTF) '%s\n' $(call quote,$(FINDINCLUDEFILTERONLY)) | $(TR) ' ;' '; '),-e $(call quote,$(subst ;, ,$(filter)))))$(and $(FINDFILTEROUT),$(space)| $(GREP)$(and $(FINDFILTEROUTEXTENDED),$(space)-E) -v $(foreach filter,$(shell $(PRINTF) '%s\n' $(call quote,$(FINDFILTEROUT)) | $(TR) ' ;' '; '),-e $(call quote,$(subst ;, ,$(filter)))))$(and $(FINDINCLUDEFILTEROUT),$(space)| $(GREP)$(and $(FINDINCLUDEFILTEROUTEXTENDED),$(space)-E) -v $(foreach filter,$(shell $(PRINTF) '%s\n' $(call quote,$(FINDINCLUDEFILTEROUT)) | $(TR) ' ;' '; '),-e $(call quote,$(subst ;, ,$(filter)))))))))
 
 # (overridable) Collect all of the applicable source files from the source directory, removing any which are also includes.
 
 # (overridable) Collect all of the applicable source files from the source directory, removing any which are also includes.
-sourcefiles := $(if $(and $(SRCDIR),$(wildcard $(SRCDIR))),$(filter-out $(sourceincludes),$(patsubst ./%,%,$(shell $(FIND) $(foreach dir,$(SRCDIR),$(call quote,$(dir))) '(' $(FINDRULES) ')' -a -type f -a -print))))
+sourcefiles := $(filter-out $(sourceincludes),$(foreach dir,$(SRCDIR),$(and $(dir),$(wildcard $(dir)),$(patsubst ./%,%,$(shell $(FIND) $(call quote,$(dir)) '(' $(FINDRULES) ')' -a -type f -a -print$(and $(FINDFILTERONLY),$(space)| $(GREP)$(and $(FINDFILTERONLYEXTENDED),$(space)-E) $(foreach filter,$(shell $(PRINTF) '%s\n' $(call quote,$(FINDFILTERONLY)) | $(TR) ' ;' '; '),-e $(call quote,$(subst ;, ,$(filter)))))$(and $(FINDFILTEROUT),$(space)| $(GREP)$(and $(FINDFILTEROUTEXTENDED),$(space)-E) -v $(foreach filter,$(shell $(PRINTF) '%s\n' $(call quote,$(FINDFILTEROUT)) | $(TR) ' ;' '; '),-e $(call quote,$(subst ;, ,$(filter))))))))))
 
 # Figure out the file type of each source file and source include.
 ifneq ($(wildcard $(BUILDDIR)/magic.mgc),)
 
 # Figure out the file type of each source file and source include.
 ifneq ($(wildcard $(BUILDDIR)/magic.mgc),)
@@ -575,7 +623,7 @@ listout :
 
 # Destroy installed files.
 uninstall :
 
 # Destroy installed files.
 uninstall :
-       $(foreach file,$(installablefiles),$(if $(wildcard $(call installed,$(file))),$(silent)$(PRINTF) '%s\n' $(call quote,Removing </$(patsubst $(DESTDIR)/%,%,$(call installed,$(file)))>…)$(newline)$(silent)$(RM) -f $(call quote,$(call installed,$(file)))$(newline),))
+       $(foreach file,$(installablefiles),$(if $(wildcard $(call installed,$(file))),$(silent)$(PRINTF) '%s\n' $(call quote,Removing </$(patsubst $(DESTDIR)/%,%,$(call installed,$(file)))>…)$(newline)$(silent)$(RM) -f -R $(call quote,$(call installed,$(file)))$(newline),))
 
 # Raise an error when attempting to build any files with recursive dependencies.
 $(call built,$(recursivefiles)) :
 
 # Raise an error when attempting to build any files with recursive dependencies.
 $(call built,$(recursivefiles)) :
@@ -649,13 +697,13 @@ $(BUILDDIR)/transform.xslt : $(BUILDDIR)/transform.catalog $(BUILDDIR)/metadata
 # • When the metadata of ⹐source files they depend on⹑ change.
 #
 # This is to reduce the number of needless regenerations of files with no substantial change.
 # • When the metadata of ⹐source files they depend on⹑ change.
 #
 # This is to reduce the number of needless regenerations of files with no substantial change.
-$(call compiled,$(compilablefiles)) : $(BUILDDIR)/results/% : $$(call parsed,$$(call uncompiled,$$@)) $$(call parsed,$$(call dependencies,$$(call uncompiled,$$@))) $(BUILDDIR)/transform.catalog $(TRANSFORMLIBS) $$(call metadata,$$(call dependencies,$$(call uncompiled,$$@)))
+$(call compiled,$(compilablefiles)) : $(BUILDDIR)/results/% : $$(call parsed,$$(call uncompiled,$$@)) $$(call parsed,$$(call dependencies,$$(call uncompiled,$$@))) $(BUILDDIR)/transform.catalog $(THISDIR)/lib/catalog2transform.xslt $(TRANSFORMLIBS) $$(call metadata,$$(call dependencies,$$(call uncompiled,$$@)))
        $(call inform,$(PRINTF) '%s\n' $(call quote,Compiling </$*>…) >&2)
        $(silent)$(call ensuredirectory,$(dir $@))
        $(silent)$(XSLTPROC) --nonet --novalid --nomkdir --nowrite --stringparam METADATA 'metadata' --stringparam BUILDTIME $$($(DATE) -u '+%Y-%m-%dT%H:%M:%SZ') --stringparam IDENTIFIER $(call quote,$(call localuri,$(call uncompiled,$@)))$(if $(THISREV), --stringparam THISREV $(call quote,$(THISREV)),)$(if $(SRCREV), --stringparam SRCREV $(call quote,$(SRCREV)),) $(call quote,$(BUILDDIR)/transform.xslt) $(call quote,$<) >|$(call quote,$@)
 
 # Create the final files from the compiled results (or error in the case of recursive ones).
        $(call inform,$(PRINTF) '%s\n' $(call quote,Compiling </$*>…) >&2)
        $(silent)$(call ensuredirectory,$(dir $@))
        $(silent)$(XSLTPROC) --nonet --novalid --nomkdir --nowrite --stringparam METADATA 'metadata' --stringparam BUILDTIME $$($(DATE) -u '+%Y-%m-%dT%H:%M:%SZ') --stringparam IDENTIFIER $(call quote,$(call localuri,$(call uncompiled,$@)))$(if $(THISREV), --stringparam THISREV $(call quote,$(THISREV)),)$(if $(SRCREV), --stringparam SRCREV $(call quote,$(SRCREV)),) $(call quote,$(BUILDDIR)/transform.xslt) $(call quote,$<) >|$(call quote,$@)
 
 # Create the final files from the compiled results (or error in the case of recursive ones).
-$(call built,$(compilablefiles)) : $(BUILDDIR)/public/% : $(BUILDDIR)/results/%
+$(call built,$(compilablefiles)) : $(BUILDDIR)/public/% : $(BUILDDIR)/results/% $(THISDIR)/lib/archive2extractor.xslt
        $(call inform,$(PRINTF) '%s\n' $(call quote,Building </$*>…) >&2)
        $(silent)$(call ensuredirectory,$(dir $@))
        $(silent)$(RM) -f -R $(call quote,$@)
        $(call inform,$(PRINTF) '%s\n' $(call quote,Building </$*>…) >&2)
        $(silent)$(call ensuredirectory,$(dir $@))
        $(silent)$(RM) -f -R $(call quote,$@)
@@ -746,7 +794,7 @@ else ifeq ($(MODE),urn:fdc:ladys.computer:20231231:Shu1She4:mode:initial)
 # ─ ¶ Non‐Recipe Variable Definitions ─────────────────────────────────
 
 # Non·empty if this is a two‐step build.
 # ─ ¶ Non‐Recipe Variable Definitions ─────────────────────────────────
 
 # Non·empty if this is a two‐step build.
-override twostep := $(if $(DATADIR),$(shell if $(TEST) -d $(call quote,$(DATADIR)); then $(PRINTF) '%s\n' '1'; fi),)
+override twostep := $(if $(DATADIR),$(call not,$(shell for dir in $(foreach dir,$(DATADIR),$(call quote,$(dir))); do if $(TEST) '!' -d "$$dir"; then $(PRINTF) '%s\n' '0'; fi; done)),)
 
 # Pair each source magic file with its location in the build directory.
 override magicpair := $(foreach magicfile,$(MAGIC),$(magicfile)|$(BUILDDIR)/magic/$(call namehash,$(magicfile)))
 
 # Pair each source magic file with its location in the build directory.
 override magicpair := $(foreach magicfile,$(MAGIC),$(magicfile)|$(BUILDDIR)/magic/$(call namehash,$(magicfile)))
@@ -768,10 +816,10 @@ ifeq ($(twostep),)
 shusheopts := MODE='urn:fdc:ladys.computer:20231231:Shu1She4:mode:default'
 else
 # (overridable) Options to use when calling ⛩📰 书社 the first time.
 shusheopts := MODE='urn:fdc:ladys.computer:20231231:Shu1She4:mode:default'
 else
 # (overridable) Options to use when calling ⛩📰 书社 the first time.
-shushedataopts := INCLUDEDIR=$(call quote,$(DATADIR)) BUILDDIR=$(call quote,$(BUILDDIR)/data) FINDRULES=$(subst $$,$$$$,$(call quote,$(FINDRULES) -a '(' $(FINDDATARULES) ')')) FINDINCLUDERULES=$(subst $$,$$$$,$(call quote,$(FINDINCLUDERULES))) MODE='urn:fdc:ladys.computer:20231231:Shu1She4:mode:default'
+shushedataopts := $(and $(DATAOPTS),$(DATAOPTS)$(space))INCLUDEDIR=$(call varquote,$(DATADIR)) BUILDDIR=$(call varquote,$(BUILDDIR)/data) FINDRULES=$(call varquote,$(FINDRULES) -a '(' $(FINDDATARULES) ')') FINDINCLUDERULES=$(call varquote,$(FINDINCLUDERULES)) MODE='urn:fdc:ladys.computer:20231231:Shu1She4:mode:default'
 
 # (overridable) Options to use when calling ⛩📰 书社 the second time.
 
 # (overridable) Options to use when calling ⛩📰 书社 the second time.
-shushesiteopts := INCLUDEDIR=$(call quote,$(INCLUDEDIR) $(BUILDDIR)/data/public) BUILDDIR=$(call quote,$(BUILDDIR)/site) FINDRULES=$(subst $$,$$$$,$(call quote,$(FINDRULES) -a '!' '(' $(FINDDATARULES) ')')) FINDINCLUDERULES=$(subst $$,$$$$,$(call quote,$(FINDINCLUDERULES))) MODE='urn:fdc:ladys.computer:20231231:Shu1She4:mode:default'
+shushesiteopts := INCLUDEDIR=$(call varquote,$(INCLUDEDIR) $(BUILDDIR)/data/public) BUILDDIR=$(call varquote,$(BUILDDIR)/site) FINDRULES=$(call varquote,$(FINDRULES) -a '!' '(' $(FINDDATARULES) ')') FINDINCLUDERULES=$(call varquote,$(FINDINCLUDERULES)) MODE='urn:fdc:ladys.computer:20231231:Shu1She4:mode:default'
 endif
 
 # ─ ¶ Recipe Variable Definitions ─────────────────────────────────────
 endif
 
 # ─ ¶ Recipe Variable Definitions ─────────────────────────────────────
@@ -807,7 +855,7 @@ clean :
 ifneq ($(twostep),)
 # Build the data and remove outdated data files.
 data : $(BUILDDIR)/data.out
 ifneq ($(twostep),)
 # Build the data and remove outdated data files.
 data : $(BUILDDIR)/data.out
-       $(silent)$(FIND) $(call quote,$(BUILDDIR)/data/public) '!' -exec $(GREP) -F -q -x '{}' $(call quote,$<) ';' -a '(' -type d -o -print ')' | $(xargsmultiquote) | $(XARGS) -E '' $(RM)
+       $(silent)$(FIND) $(call quote,$(BUILDDIR)/data/public) '!' '(' -exec $(GREP) -F -q -x '{}' $(call quote,$<) ';' -a -prune ')' -a '(' -type d -o -print ')' | $(xargsmultiquote) | $(XARGS) -E '' $(RM)
 endif
 
 # Provide help.
 endif
 
 # Provide help.
index af78725ca5fbbe8ff42789a6e0ae25b620979606..70a9730182b25a89b8542b8a8bed91a3aa875931 100644 (file)
@@ -1,5 +1,5 @@
 <!--
 <!--
-SPDX-FileCopyrightText: 2024 Lady <https://www.ladys.computer/about/#lady>
+SPDX-FileCopyrightText: 2024, 2025 Lady <https://www.ladys.computer/about/#lady>
 SPDX-License-Identifier: CC0-1.0
 -->
 # ⛩📰 书社
 SPDX-License-Identifier: CC0-1.0
 -->
 # ⛩📰 书社
@@ -307,6 +307,12 @@ The following additional variables can be used to control the behaviour
     default, to enable additional rules without overriding the existing
     ones.
 
     default, to enable additional rules without overriding the existing
     ones.
 
+- **`DATAOPTS`:**
+  Additional options to use when calling Make during the first stage of a two‐stage build using `DATADIR`.
+
+  This can be used to override variables which are only applicable during the second stage.
+  Note that when supplying this variable on the shell, it will need to be double‐quoted.
+
 - **`DATAEXT`:**
   A list of file extensions which signify “data” files during a two‐stage build using `DATADIR`.
 
 - **`DATAEXT`:**
   A list of file extensions which signify “data” files during a two‐stage build using `DATADIR`.
 
@@ -319,6 +325,32 @@ The following additional variables can be used to control the behaviour
     default, to enable additional rules without overriding the existing
     ones.
 
     default, to enable additional rules without overriding the existing
     ones.
 
+- **`FINDFILTERONLY`:**
+  A semicolon‐separated list of regular expressions, at least one of which the paths for sources and includes are required to match, unless empty (default: empty).
+
+- **`FINDFILTEROUT`:**
+  A semicolon‐separated list of regular expressions, each of which matches paths that should _not_ be considered sources or includes (default: empty).
+
+- **`FINDINCLUDEFILTERONLY`:**
+  A semicolon‐separated list of regular expressions, at least one of which the paths for includes are required to match, unless empty (default: empty).
+
+  Note that only paths which already match `FINDFILTERONLY` are considered.
+
+- **`FINDINCLUDEFILTEROUT`:**
+  A semicolon‐separated list of regular expressions, each of which matches paths that should _not_ be considered includes, but may still be considered sources (default: empty).
+
+- **`FINDFILTERONLYEXTENDED`:**
+  If non·empty, `FINDFILTERONLY` is an extended regular expression; otherwise, it is basic (default: empty).
+
+- **`FINDFILTEROUTEXTENDED`:**
+  If non·empty, `FINDFILTEROUT` is an extended regular expression; otherwise, it is basic (default: matches `FINDFILTERONLYEXTENDED`).
+
+- **`FINDINCLUDEFILTERONLYEXTENDED`:**
+  If non·empty, `FINDINCLUDEFILTERONLY` is an extended regular expression; otherwise, it is basic (default: matches `FINDFILTERONLYEXTENDED`).
+
+- **`FINDINCLUDEFILTEROUTEXTENDED`:**
+  If non·empty, `FINDINCLUDEFILTEROUT` is an extended regular expression; otherwise, it is basic (default: `1` if either `FINDFILTEROUTEXTENDED` or `FINDINCLUDEFILTERONLYEXTENDED` is non·empty).
+
 - **`PARSERS`:**
   A white·space‐separated list of parsers to use (default:
     `$(THISDIR)/parsers/*.xslt`).
 - **`PARSERS`:**
   A white·space‐separated list of parsers to use (default:
     `$(THISDIR)/parsers/*.xslt`).
index b07b734046fe3d5d6425a7ceea5df36e0195b0f6..f9c8bdf4bf688596bec0d02d1d1a0dc731f125b7 100644 (file)
@@ -1,12 +1,12 @@
 <?xml version="1.0"?>
 <!--
 <?xml version="1.0"?>
 <!--
-SPDX-FileCopyrightText: 2024 Lady <https://www.ladys.computer/about/#lady>
+SPDX-FileCopyrightText: 2024, 2025 Lady <https://www.ladys.computer/about/#lady>
 SPDX-License-Identifier: MPL-2.0
 -->
 <!--
 ⁌ ⛩📰 书社 ∷ lib/archive2extractor.xslt
 
 SPDX-License-Identifier: MPL-2.0
 -->
 <!--
 ⁌ ⛩📰 书社 ∷ lib/archive2extractor.xslt
 
-© 2024 Lady [@ Ladys Computer].
+© 2024–2025 Lady [@ Ladys Computer].
 
 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
 
 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
@@ -38,7 +38,11 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                <xslt:variable name="href">
                                                        <value-of select="@书社:archived-as"/>
                                                </xslt:variable>
                                                <xslt:variable name="href">
                                                        <value-of select="@书社:archived-as"/>
                                                </xslt:variable>
-                                               <xslt:copy-of select="书社:archive/*[@书社:archived-as=$href][1]"/>
+                                               <xslt:for-each select="书社:archive/*[@书社:archived-as=$href][1]">
+                                                       <xslt:copy>
+                                                               <xslt:copy-of select="@*[not(namespace-uri()='urn:fdc:ladys.computer:20231231:Shu1She4' and local-name()='archived-as')]|node()"/>
+                                                       </xslt:copy>
+                                               </xslt:for-each>
                                        </exsl:document>
                                        <xslt:text>
                                                <value-of select="$href"/>
                                        </exsl:document>
                                        <xslt:text>
                                                <value-of select="$href"/>
index 6d2046030403bea9c81bc9fa75d3f55be2e98ef5..ce94067fa445d9b88b3fd63ba1f37836d62c40e4 100644 (file)
@@ -1,18 +1,19 @@
 <?xml version="1.0"?>
 <!--
 <?xml version="1.0"?>
 <!--
-SPDX-FileCopyrightText: 2023, 2024 Lady <https://www.ladys.computer/about/#lady>
+SPDX-FileCopyrightText: 2023, 2024, 2025 Lady <https://www.ladys.computer/about/#lady>
 SPDX-License-Identifier: MPL-2.0
 -->
 <!--
 ⁌ ⛩📰 书社 ∷ lib/catalog2transform.xslt
 
 SPDX-License-Identifier: MPL-2.0
 -->
 <!--
 ⁌ ⛩📰 书社 ∷ lib/catalog2transform.xslt
 
-© 2023–2024 Lady [@ Ladys Computer].
+© 2023–2025 Lady [@ Ladys Computer].
 
 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
 -->
 <!DOCTYPE transform [
        <!ENTITY 书社 "urn:fdc:ladys.computer:20231231:Shu1She4">
 
 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
 -->
 <!DOCTYPE transform [
        <!ENTITY 书社 "urn:fdc:ladys.computer:20231231:Shu1She4">
+       <!ENTITY xhtml "http://www.w3.org/1999/xhtml">
        <!ENTITY xml "http://www.w3.org/XML/1998/namespace">
 ]>
 <transform
        <!ENTITY xml "http://www.w3.org/XML/1998/namespace">
 ]>
 <transform
@@ -21,7 +22,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
        xmlns:exsl="http://exslt.org/common"
        xmlns:exslfunc="http://exslt.org/functions"
        xmlns:exslstr="http://exslt.org/strings"
        xmlns:exsl="http://exslt.org/common"
        xmlns:exslfunc="http://exslt.org/functions"
        xmlns:exslstr="http://exslt.org/strings"
-       xmlns:html="http://www.w3.org/1999/xhtml"
+       xmlns:html="&xhtml;"
        xmlns:nie="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#"
        xmlns:nfo="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:nie="http://www.semanticdesktop.org/ontologies/2007/01/19/nie#"
        xmlns:nfo="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@@ -220,7 +221,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                        <xslt:apply-templates select="$modalinput/node()" mode="书社:metadata"/>
                                </xslt:variable>
                                <xslt:variable name="metadata" select="exsl:node-set($metadata-fragment)"/>
                                        <xslt:apply-templates select="$modalinput/node()" mode="书社:metadata"/>
                                </xslt:variable>
                                <xslt:variable name="metadata" select="exsl:node-set($metadata-fragment)"/>
-                               <html:html>
+                               <xslt:element name="html" namespace="&xhtml;">
                                        <xslt:copy-of select="$nodes[self::html:html]/@*"/>
                                        <xslt:if test="not($nodes[self::html:html]/@书社:archived-as) and $nodes/@书社:archived-as">
                                                <xslt:attribute name="书社:archived-as">
                                        <xslt:copy-of select="$nodes[self::html:html]/@*"/>
                                        <xslt:if test="not($nodes[self::html:html]/@书社:archived-as) and $nodes/@书社:archived-as">
                                                <xslt:attribute name="书社:archived-as">
@@ -237,9 +238,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                        <xslt:value-of select="$nodes[self::html:*]/@lang|$nodes[self::svg:*]/@lang|$nodes/@xml:lang"/>
                                                </xslt:attribute>
                                        </xslt:if>
                                                        <xslt:value-of select="$nodes[self::html:*]/@lang|$nodes[self::svg:*]/@lang|$nodes/@xml:lang"/>
                                                </xslt:attribute>
                                        </xslt:if>
-                                       <html:head>
+                                       <xslt:element name="head" namespace="&xhtml;">
                                                <xslt:copy-of select="$nodes[self::html:html]/html:head/@*|$nodes[self::html:head]/@*"/>
                                                <xslt:copy-of select="$nodes[self::html:html]/html:head/@*|$nodes[self::html:head]/@*"/>
-                                               <html:title>
+                                               <xslt:element name="title" namespace="&xhtml;">
                                                        <xslt:for-each select="$metadata/html:title">
                                                                <xslt:value-of select="."/>
                                                                <xslt:if test="position()!=last()">
                                                        <xslt:for-each select="$metadata/html:title">
                                                                <xslt:value-of select="."/>
                                                                <xslt:if test="position()!=last()">
@@ -248,9 +249,14 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                                        </xslt:text>
                                                                </xslt:if>
                                                        </xslt:for-each>
                                                                        </xslt:text>
                                                                </xslt:if>
                                                        </xslt:for-each>
-                                               </html:title>
+                                               </xslt:element>
                                                <xslt:copy-of select="$metadata/node()[not(self::html:title or self::html:meta and @name='generator')]"/>
                                                <xslt:copy-of select="$metadata/node()[not(self::html:title or self::html:meta and @name='generator')]"/>
-                                               <html:meta name="generator">
+                                               <xslt:element name="meta" namespace="&xhtml;">
+                                                       <xslt:attribute name="name">
+                                                               <xslt:text>
+                                                                       <text>generator</text>
+                                                               </xslt:text>
+                                                       </xslt:attribute>
                                                        <xslt:attribute name="content">
                                                                <xslt:for-each select="$metadata/html:meta[@name='generator']">
                                                                        <xslt:value-of select="@content"/>
                                                        <xslt:attribute name="content">
                                                                <xslt:for-each select="$metadata/html:meta[@name='generator']">
                                                                        <xslt:value-of select="@content"/>
@@ -271,15 +277,19 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                                        </xslt:text>
                                                                </xslt:if>
                                                        </xslt:attribute>
                                                                        </xslt:text>
                                                                </xslt:if>
                                                        </xslt:attribute>
-                                               </html:meta>
-                                       </html:head>
-                                       <html:body>
-                                               <xslt:copy-of select="$nodes[self::html:html]/html:body/@*|$nodes[self::html:body]/@*"/>
+                                               </xslt:element>
+                                       </xslt:element>
+                                       <xslt:element name="body" namespace="&xhtml;">
+                                               <xslt:copy-of select="($nodes[self::html:html]/html:body/@*|$nodes[self::html:body]/@*)[not(namespace-uri()='&书社;' and local-name()='archived-as')]"/>
                                                <xslt:apply-templates select="$modalinput/node()" mode="书社:header"/>
                                                <xslt:apply-templates select="$modalinput/node()" mode="书社:header"/>
-                                               <xslt:copy-of select="$nodes[not(self::html:html or self::html:head or self::html:body)]|$nodes[self::html:html]/node()[not(self::html:head or self::html:body)]|$nodes[self::html:html]/html:body/node()|$nodes[self::html:body]/node()"/>
+                                               <xslt:for-each select="$nodes[not(self::html:html or self::html:head or self::html:body)]|$nodes[self::html:html]/node()[not(self::html:head or self::html:body)]|$nodes[self::html:html]/html:body/node()|$nodes[self::html:body]/node()">
+                                                       <xslt:copy>
+                                                               <xslt:copy-of select="@*[not(namespace-uri()='&书社;' and local-name()='archived-as')]|node()"/>
+                                                       </xslt:copy>
+                                               </xslt:for-each>
                                                <xslt:apply-templates select="$modalinput/node()" mode="书社:footer"/>
                                                <xslt:apply-templates select="$modalinput/node()" mode="书社:footer"/>
-                                       </html:body>
-                               </html:html>
+                                       </xslt:element>
+                               </xslt:element>
                        </xslt:template>
                        <xslt:template match="/">
                                <xslt:variable name="finalization-fragment">
                        </xslt:template>
                        <xslt:template match="/">
                                <xslt:variable name="finalization-fragment">
index 01e6f8d15beaed5f7af054b898e106761f1fa8f9..3430526d5c37378eb1242d18c0068aa8f9fed3be 100644 (file)
@@ -11,14 +11,19 @@ SPDX-License-Identifier: MPL-2.0
 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
 -->
 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
 -->
+<!DOCTYPE transform [
+       <!ENTITY xhtml 'http://www.w3.org/1999/xhtml'>
+]>
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
-       xmlns:html="http://www.w3.org/1999/xhtml"
+       xmlns:html="&xhtml;"
        xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
        version="1.0"
 >
        <书社:id>urn:fdc:ladys.computer:20231231:Shu1She4:plain.xslt</书社:id>
        <template match="html:script[@type='text/plain']">
        xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
        version="1.0"
 >
        <书社:id>urn:fdc:ladys.computer:20231231:Shu1She4:plain.xslt</书社:id>
        <template match="html:script[@type='text/plain']">
-               <html:pre><value-of select="."/></html:pre>
+               <element name="pre" namespace="&xhtml;">
+                       <value-of select="."/>
+               </element>
        </template>
 </transform>
        </template>
 </transform>
index abaf08c04e450c09331cc81e3d55722448cc1ae6..b58505d3600da93e842ae752f1581a4fa30f6cc2 100644 (file)
@@ -11,11 +11,14 @@ SPDX-License-Identifier: MPL-2.0
 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
 -->
 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
 -->
+<!DOCTYPE transform [
+       <!ENTITY xhtml 'http://www.w3.org/1999/xhtml'>
+]>
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
        xmlns:exsl="http://exslt.org/common"
        xmlns:exslstr="http://exslt.org/strings"
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
        xmlns:exsl="http://exslt.org/common"
        xmlns:exslstr="http://exslt.org/strings"
-       xmlns:html="http://www.w3.org/1999/xhtml"
+       xmlns:html="&xhtml;"
        xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
        extension-element-prefixes="exsl exslstr"
        version="1.0"
        xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
        extension-element-prefixes="exsl exslstr"
        version="1.0"
@@ -23,7 +26,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
        <书社:id>urn:fdc:ladys.computer:20231231:Shu1She4:record-jar.xslt</书社:id>
        <template match="html:script[@type='text/record-jar']">
                <variable name="lines" select="exslstr:tokenize(., '&#xA;')"/>
        <书社:id>urn:fdc:ladys.computer:20231231:Shu1She4:record-jar.xslt</书社:id>
        <template match="html:script[@type='text/record-jar']">
                <variable name="lines" select="exslstr:tokenize(., '&#xA;')"/>
-               <html:div>
+               <element name="div" namespace="&xhtml;">
                        <if test="starts-with($lines[1], '%%') and substring-after($lines[1], '%%')!=''">
                                <comment>
                                        <value-of select="substring-after($lines[1], '%%')"/>
                        <if test="starts-with($lines[1], '%%') and substring-after($lines[1], '%%')!=''">
                                <comment>
                                        <value-of select="substring-after($lines[1], '%%')"/>
@@ -34,17 +37,17 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                <variable name="start" select="preceding-sibling::*[starts-with(., '%%')][1]"/>
                                <variable name="fields" select="($start/following-sibling::*|$lines[not($start)])[not(preceding-sibling::*[generate-id()=generate-id($end)]) and not(starts-with(., '%%'))]"/>
                                <if test="$fields">
                                <variable name="start" select="preceding-sibling::*[starts-with(., '%%')][1]"/>
                                <variable name="fields" select="($start/following-sibling::*|$lines[not($start)])[not(preceding-sibling::*[generate-id()=generate-id($end)]) and not(starts-with(., '%%'))]"/>
                                <if test="$fields">
-                                       <html:dl>
+                                       <element name="dl" namespace="&xhtml;">
                                                <for-each select="$fields">
                                                        <choose>
                                                                <when test="starts-with(., ' ') and $fields[generate-id()=generate-id(current()/preceding-sibling::*[1])]"/>
                                                                <otherwise>
                                                                        <variable name="next" select="following-sibling::*[not(starts-with(., ' '))]"/>
                                                <for-each select="$fields">
                                                        <choose>
                                                                <when test="starts-with(., ' ') and $fields[generate-id()=generate-id(current()/preceding-sibling::*[1])]"/>
                                                                <otherwise>
                                                                        <variable name="next" select="following-sibling::*[not(starts-with(., ' '))]"/>
-                                                                       <html:div>
-                                                                               <html:dt>
+                                                                       <element name="div" namespace="&xhtml;">
+                                                                               <element name="dt" namespace="&xhtml;">
                                                                                        <value-of select="normalize-space(substring-before(., ':'))"/>
                                                                                        <value-of select="normalize-space(substring-before(., ':'))"/>
-                                                                               </html:dt>
-                                                                               <html:dd>
+                                                                               </element>
+                                                                               <element name="dd" namespace="&xhtml;">
                                                                                        <variable name="firstline">
                                                                                                <choose>
                                                                                                        <when test="contains(., ':')">
                                                                                        <variable name="firstline">
                                                                                                <choose>
                                                                                                        <when test="contains(., ':')">
@@ -74,12 +77,12 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                                                                        </otherwise>
                                                                                                </choose>
                                                                                        </for-each>
                                                                                                        </otherwise>
                                                                                                </choose>
                                                                                        </for-each>
-                                                                               </html:dd>
-                                                                       </html:div>
+                                                                               </element>
+                                                                       </element>
                                                                </otherwise>
                                                        </choose>
                                                </for-each>
                                                                </otherwise>
                                                        </choose>
                                                </for-each>
-                                       </html:dl>
+                                       </element>
                                </if>
                                <if test="substring-after(., '%%')!=''">
                                        <comment>
                                </if>
                                <if test="substring-after(., '%%')!=''">
                                        <comment>
@@ -87,6 +90,6 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                        </comment>
                                </if>
                        </for-each>
                                        </comment>
                                </if>
                        </for-each>
-               </html:div>
+               </element>
        </template>
 </transform>
        </template>
 </transform>
index 5b3cc684f6821c0e3a85f09e2637d7027c391c00..90e156e28c776c3b51bf74b557c1e35a687e5396 100644 (file)
@@ -11,11 +11,14 @@ SPDX-License-Identifier: MPL-2.0
 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
 -->
 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
 -->
+<!DOCTYPE transform [
+       <!ENTITY xhtml 'http://www.w3.org/1999/xhtml'>
+]>
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
        xmlns:exsl="http://exslt.org/common"
        xmlns:exslstr="http://exslt.org/strings"
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
        xmlns:exsl="http://exslt.org/common"
        xmlns:exslstr="http://exslt.org/strings"
-       xmlns:html="http://www.w3.org/1999/xhtml"
+       xmlns:html="&xhtml;"
        xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
        extension-element-prefixes="exsl exslstr"
        version="1.0"
        xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
        extension-element-prefixes="exsl exslstr"
        version="1.0"
@@ -31,22 +34,25 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                <with-param name="separator" select="'&#x9;'"/>
                        </call-template>
                </variable>
                                <with-param name="separator" select="'&#x9;'"/>
                        </call-template>
                </variable>
-               <html:table>
+               <element name="table" namespace="&xhtml;">
                        <for-each select="$lines[starts-with(., '#') and following-sibling::*[generate-id(.)=generate-id($head)]]">
                                <comment>
                                        <value-of select="substring-after(., '#')"/>
                                </comment>
                        </for-each>
                        <for-each select="$lines[starts-with(., '#') and following-sibling::*[generate-id(.)=generate-id($head)]]">
                                <comment>
                                        <value-of select="substring-after(., '#')"/>
                                </comment>
                        </for-each>
-                       <html:thead>
-                               <html:tr>
+                       <element name="thead" namespace="&xhtml;">
+                               <element name="tr" namespace="&xhtml;">
                                        <for-each select="exsl:node-set($headcols)/*">
                                        <for-each select="exsl:node-set($headcols)/*">
-                                               <html:th scope="col">
+                                               <element name="th" namespace="&xhtml;">
+                                                       <attribute name="scope">
+                                                               <text>col</text>
+                                                       </attribute>
                                                        <value-of select="."/>
                                                        <value-of select="."/>
-                                               </html:th>
+                                               </element>
                                        </for-each>
                                        </for-each>
-                               </html:tr>
-                       </html:thead>
-                       <html:tbody>
+                               </element>
+                       </element>
+                       <element name="tbody" namespace="&xhtml;">
                                <for-each select="$head/following-sibling::*[normalize-space(.)!='']">
                                        <choose>
                                                <when test="starts-with(., '#')">
                                <for-each select="$head/following-sibling::*[normalize-space(.)!='']">
                                        <choose>
                                                <when test="starts-with(., '#')">
@@ -61,9 +67,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                                        <with-param name="separator" select="'&#x9;'"/>
                                                                </call-template>
                                                        </variable>
                                                                        <with-param name="separator" select="'&#x9;'"/>
                                                                </call-template>
                                                        </variable>
-                                                       <html:tr>
+                                                       <element name="tr" namespace="&xhtml;">
                                                                <for-each select="exsl:node-set($cols)/*[count(exsl:node-set($headcols)/*)>=position()]">
                                                                <for-each select="exsl:node-set($cols)/*[count(exsl:node-set($headcols)/*)>=position()]">
-                                                                       <html:td>
+                                                                       <element name="td" namespace="&xhtml;">
                                                                                <attribute name="data-tsv-header">
                                                                                        <value-of select="exsl:node-set($headcols)/*[count(current()/preceding-sibling::*)+1]"/>
                                                                                </attribute>
                                                                                <attribute name="data-tsv-header">
                                                                                        <value-of select="exsl:node-set($headcols)/*[count(current()/preceding-sibling::*)+1]"/>
                                                                                </attribute>
@@ -74,16 +80,16 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
                                                                                                <value-of select="."/>
                                                                                        </for-each>
                                                                                </if>
                                                                                                <value-of select="."/>
                                                                                        </for-each>
                                                                                </if>
-                                                                       </html:td>
+                                                                       </element>
                                                                </for-each>
                                                                <for-each select="exsl:node-set($headcols)/*[position()>count(exsl:node-set($cols)/*)]">
                                                                </for-each>
                                                                <for-each select="exsl:node-set($headcols)/*[position()>count(exsl:node-set($cols)/*)]">
-                                                                       <html:td/>
+                                                                       <element name="td" namespace="&xhtml;"/>
                                                                </for-each>
                                                                </for-each>
-                                                       </html:tr>
+                                                       </element>
                                                </otherwise>
                                        </choose>
                                </for-each>
                                                </otherwise>
                                        </choose>
                                </for-each>
-                       </html:tbody>
-               </html:table>
+                       </element>
+               </element>
        </template>
 </transform>
        </template>
 </transform>
index 2b4359510c0ace6bf6025e71f5d2c6fc089b1bd7..89f1475598f78bf318947bd031cc53c2ecbaafb8 100644 (file)
@@ -13,11 +13,12 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 -->
 <!DOCTYPE transform [
        <!ENTITY wrapped "ancestor::html:html[not(parent::* or @书社:disable-output-wrapping)]">
 -->
 <!DOCTYPE transform [
        <!ENTITY wrapped "ancestor::html:html[not(parent::* or @书社:disable-output-wrapping)]">
+       <!ENTITY xhtml "http://www.w3.org/1999/xhtml">
 ]>
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
        xmlns:exsl="http://exslt.org/common"
 ]>
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
        xmlns:exsl="http://exslt.org/common"
-       xmlns:html="http://www.w3.org/1999/xhtml"
+       xmlns:html="&xhtml;"
        xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
        extension-element-prefixes="exsl"
        version="1.0"
        xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
        extension-element-prefixes="exsl"
        version="1.0"
@@ -25,30 +26,56 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
        <书社:id>urn:fdc:ladys.computer:20231231:Shu1She4:asset.xslt</书社:id>
        <template match="html:style[&wrapped; and not(ancestor::html:head)]|html:object[@type='text/css' and &wrapped;]" mode="书社:finalize" priority="0"/>
        <template match="html:object[@type='text/javascript']" mode="书社:finalize" priority="0">
        <书社:id>urn:fdc:ladys.computer:20231231:Shu1She4:asset.xslt</书社:id>
        <template match="html:style[&wrapped; and not(ancestor::html:head)]|html:object[@type='text/css' and &wrapped;]" mode="书社:finalize" priority="0"/>
        <template match="html:object[@type='text/javascript']" mode="书社:finalize" priority="0">
-               <html:script type="{@type}" src="{@data}">
+               <element name="script" namespace="&xhtml;">
+                       <attribute name="type">
+                               <value-of select="@type"/>
+                       </attribute>
+                       <attribute name="src">
+                               <value-of select="@data"/>
+                       </attribute>
                        <copy-of select="@书社:identifier"/>
                        <copy-of select="@书社:identifier"/>
-               </html:script>
+               </element>
        </template>
        <template match="html:object[starts-with(@type, 'audio/')]" mode="书社:finalize" priority="0">
        </template>
        <template match="html:object[starts-with(@type, 'audio/')]" mode="书社:finalize" priority="0">
-               <html:audio controls="" src="{@data}">
+               <element name="audio" namespace="&xhtml;">
+                       <attribute name="controls"/>
+                       <attribute name="src">
+                               <value-of select="@data"/>
+                       </attribute>
                        <copy-of select="@书社:identifier"/>
                        <copy-of select="@书社:identifier"/>
-               </html:audio>
+               </element>
        </template>
        <template match="html:object[starts-with(@type, 'image/') and not(@type='image/svg+xml')]" mode="书社:finalize" priority="0">
        </template>
        <template match="html:object[starts-with(@type, 'image/') and not(@type='image/svg+xml')]" mode="书社:finalize" priority="0">
-               <html:img src="{@data}">
+               <element name="img" namespace="&xhtml;">
+                       <attribute name="src">
+                               <value-of select="@data"/>
+                       </attribute>
                        <copy-of select="@书社:identifier|@width|@height"/>
                        <copy-of select="@书社:identifier|@width|@height"/>
-               </html:img>
+               </element>
        </template>
        <template match="html:object[starts-with(@type, 'video/')]" mode="书社:finalize" priority="0">
        </template>
        <template match="html:object[starts-with(@type, 'video/')]" mode="书社:finalize" priority="0">
-               <html:video controls="" src="{@data}">
+               <element name="video" namespace="&xhtml;">
+                       <attribute name="controls"/>
+                       <attribute name="src">
+                               <value-of select="@data"/>
+                       </attribute>
                        <copy-of select="@书社:identifier|@width|@height"/>
                        <copy-of select="@书社:identifier|@width|@height"/>
-               </html:video>
+               </element>
        </template>
        <template match="书社:id[string(.)='urn:fdc:ladys.computer:20231231:Shu1She4:asset.xslt']" mode="书社:metadata">
                <for-each select="$书社:expansion//html:object[@type='text/css']">
        </template>
        <template match="书社:id[string(.)='urn:fdc:ladys.computer:20231231:Shu1She4:asset.xslt']" mode="书社:metadata">
                <for-each select="$书社:expansion//html:object[@type='text/css']">
-                       <html:link rel="stylesheet" type="text/css" href="{@data}">
+                       <element name="link" namespace="&xhtml;">
+                               <attribute name="rel">
+                                       <text>stylesheet</text>
+                               </attribute>
+                               <attribute name="type">
+                                       <text>text/css</text>
+                               </attribute>
+                               <attribute name="href">
+                                       <value-of select="@data"/>
+                               </attribute>
                                <copy-of select="@书社:identifier"/>
                                <copy-of select="@书社:identifier"/>
-                       </html:link>
+                       </element>
                </for-each>
                <for-each select="$书社:expansion//html:style[not(ancestor::html:head)]">
                        <copy-of select="."/>
                </for-each>
                <for-each select="$书社:expansion//html:style[not(ancestor::html:head)]">
                        <copy-of select="."/>
index 71a10c515ecf02a86b60f7e0c4f5c465e0d04584..c4817509323cab4149ecdbceb974984ee45c2953 100644 (file)
@@ -13,18 +13,19 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
 -->
 <!DOCTYPE transform [
        <!ENTITY attoplevel "not(ancestor::html:template) and ancestor::html:*[@itemscope and @itemtype='&书社;:document'] and not(ancestor::html:*[@itemscope]/ancestor::html:*[@itemscope and @itemtype='&书社;:document'] or preceding::html:*[@itemtype='&书社;:document'])">
 -->
 <!DOCTYPE transform [
        <!ENTITY attoplevel "not(ancestor::html:template) and ancestor::html:*[@itemscope and @itemtype='&书社;:document'] and not(ancestor::html:*[@itemscope]/ancestor::html:*[@itemscope and @itemtype='&书社;:document'] or preceding::html:*[@itemtype='&书社;:document'])">
+       <!ENTITY xhtml "http://www.w3.org/1999/xhtml">
        <!ENTITY 书社 "urn:fdc:ladys.computer:20231231:Shu1She4">
 ]>
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
        <!ENTITY 书社 "urn:fdc:ladys.computer:20231231:Shu1She4">
 ]>
 <transform
        xmlns="http://www.w3.org/1999/XSL/Transform"
-       xmlns:html="http://www.w3.org/1999/xhtml"
-       xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
+       xmlns:html="&xhtml;"
+       xmlns:书社="&书社;"
        version="1.0"
 >
        <书社:id>urn:fdc:ladys.computer:20231231:Shu1She4:metadata.xslt</书社:id>
        <template match="html:meta[not(@name) and @itemprop='&书社;:title'][&attoplevel;]" mode="书社:metadata">
        version="1.0"
 >
        <书社:id>urn:fdc:ladys.computer:20231231:Shu1She4:metadata.xslt</书社:id>
        <template match="html:meta[not(@name) and @itemprop='&书社;:title'][&attoplevel;]" mode="书社:metadata">
-               <html:title>
+               <element name="title" namespace="&xhtml;">
                        <value-of select="@content"/>
                        <value-of select="@content"/>
-               </html:title>
+               </element>
        </template>
 </transform>
        </template>
 </transform>
This page took 0.260567 seconds and 4 git commands to generate.