From: Lady <redacted>
Date: Wed, 31 Jan 2024 05:40:55 +0000 (-0500)
Subject: Add EXTRA* variables
X-Git-Tag: 0.5.0~7
X-Git-Url: https://git.ladys.computer/Shushe/commitdiff_plain/b03ac9094ce56f3591816f976cd5a4c97be492ac

Add EXTRA* variables

It shouldn’t be necessary to know where existing parsers and transforms
are kept or what the default find rules are in order to supply
additional ones.
---

diff --git a/GNUmakefile b/GNUmakefile
index bcaa00d..1fe78ec 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -145,16 +145,20 @@ MAGICDIR := $(patsubst ./%,%,$(THISDIR)/magic)
 # Configuration of `find´.
 #
 # By default, `find´ will ignore files which begin with a period and those which are likely to cause problems for `make´.
-FINDRULES := ! '(' '(' -name '[.-]*' -o -name '*[][*?:|$$%\#\\; ]*' ')' -a -prune ')'
-FINDINCLUDERULES := $(FINDRULES)
+EXTRAFINDRULES :=
+EXTRAFINDINCLUDERULES :=
+FINDRULES := ! '(' '(' -name '[.-]*' -o -name '*[][*?:|$$%\#\\; ]*' ')' -a -prune ')'$(if $(EXTRAFINDRULES), -a $(EXTRAFINDRULES),)
+FINDINCLUDERULES := $(FINDRULES)$(if $(EXTRAFINDINCLUDERULES), -a $(EXTRAFINDINCLUDERULES),)
 
 # The list of parsers for plaintext file types.
 #
 # Which parsers are provided will influence which kinds of files are recognized as plaintext.
-PARSERS := $(patsubst ./%,%,$(wildcard $(THISDIR)/parsers/*.xslt))
+EXTRAPARSERS :=
+PARSERS := $(sort $(patsubst ./%,%,$(wildcard $(THISDIR)/parsers/*.xslt)) $(EXTRAPARSERS))
 
 # The list of transforms.
-TRANSFORMS := $(patsubst ./%,%,$(wildcard $(THISDIR)/transforms/*.xslt))
+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
diff --git a/README.markdown b/README.markdown
index 9d51889..654904a 100644
--- a/README.markdown
+++ b/README.markdown
@@ -173,18 +173,35 @@ The following additional variables can be used to control the behaviour
     and those which contain a hash, buck, percent, asterisk, colon,
     semi, eroteme, bracket, backslash, or pipe.
 
+- **`EXTRAFINDRULES`:**
+  The value of this variable is appended to `FINDRULES` by default, to
+    enable additional rules without overriding the existing ones.
+
 - **`FINDINCLUDERULES`:**
   Rules to use with `find` when searching for includes (default:
     `$(FINDRULES)`).
 
+- **`EXTRAFINDINCLUDERULES`:**
+  The value of this variable is appended to `FINDINCLUDERULES` by
+    default, to enable additional rules without overriding the existing
+    ones.
+
 - **`PARSERS`:**
   A white·space‐separated list of parsers to use (default:
     `$(THISDIR)/parsers/*.xslt`).
 
+- **`EXTRAPARSERS`:**
+  The value of this variable is appended to `PARSERS` by default, to
+    enable additional parsers without overriding the existing ones.
+
 - **`TRANSFORMS`:**
   A white·space‐separated list of transforms to use (default:
     `$(THISDIR)/transforms/*.xslt`).
 
+- **`EXTRATRANSFORMS`:**
+  The value of this variable is appended to `TRANSFORMS` by default, to
+    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`).