]> Lady’s Gitweb - Shushe/commitdiff
Support +xml suffix for determining X·M·L files
authorLady <redacted>
Tue, 21 May 2024 03:19:48 +0000 (23:19 -0400)
committerLady <redacted>
Tue, 21 May 2024 04:09:48 +0000 (00:09 -0400)
This gets around operating system extensions to `file` which might
identify S·V·G files (for example) as `image/svg+xml` before
attempting magic detection. If not every X·M·L‐based syntax should be
handled as such by ⛩️📰 书社, redefine `XMLTYPES` to exclude the
`+xml`.

GNUmakefile
README.markdown

index 338c55d5269cc0f8a782176f57ef887407d737f2..77650952d395d1ee58c9eea215877871f14266fd 100644 (file)
@@ -193,7 +193,10 @@ EXTRATRANSFORMS :=
 TRANSFORMS := $(sort $(patsubst ./%,%,$(wildcard $(THISDIR)/transforms/*.xslt)) $(EXTRATRANSFORMS))
 
 # List of types which should be treated as X·M·L.
-XMLTYPES := application/xml text/xml
+#
+# Types which start with a `+´ are suffixes and match any type which
+# ends accordingly.
+XMLTYPES := application/xml text/xml +xml
 
 ifdef GIT
 ifneq ($(wildcard $(THISDIR)/.git),)
@@ -343,8 +346,10 @@ ifneq ($(wildcard $(BUILDDIR)/parser.xslt),)
 override plaintexttypes := $(filter-out $(XMLTYPES),$(shell $(XMLLINT) --xpath '/*/*[@name="书社:parsers"]//*[namespace-uri()="http://www.w3.org/1999/xhtml" and local-name()="dd"]/text()' $(call quote,$(BUILDDIR)/parser.xslt)))
 endif
 
-# (callable) Get all of the files (source and includes) which have the given types.
-override filesoftype = $(foreach type,$1,$(patsubst %|$(type),%,$(filter %|$(type),$(types))))
+# (callable) Get all of the files (source and includes) which have the provided types.
+#
+# If a provided type begins with a `+´, it is analysed as a suffix, and all matching types will be used.
+override filesoftype = $(foreach typeorsuffix,$1,$(foreach type,$(if $(filter +%,$(typeorsuffix)),$(sort $(foreach suffixedtype,$(filter %$(typeorsuffix),$(types)),$(lastword $(subst |, ,$(suffixedtype))))),$(typeorsuffix)),$(patsubst %|$(type),%,$(filter %|$(type),$(types)))))
 
 # Build up collections of various file types.
 override xmlfiles := $(call filesoftype,$(XMLTYPES))
index 86d57bce7073222d7a25120d49e05c761cbe176d..53427904a72fea844ba0169c5a96ea5f541e1eea 100644 (file)
@@ -292,8 +292,8 @@ The following additional variables can be used to control the behaviour
     enable additional transforms without overriding the existing ones.
 
 - **`XMLTYPES`:**
-  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 or media type suffixes to
+    consider X·M·L (default: `application/xml text/xml +xml`).
 
 - **`THISREV`:**
   The current version of ⛩️📰 书社 (default: derived from the current
This page took 0.0609 seconds and 4 git commands to generate.