]> Lady’s Gitweb - Shushe/commitdiff
Use --noent when calling xmllint
authorLady <redacted>
Mon, 27 May 2024 18:41:47 +0000 (14:41 -0400)
committerLady <redacted>
Sat, 22 Jun 2024 16:13:15 +0000 (12:13 -0400)
The X·Path expressions do not correctly match text provided within
entities if the entities are not expanded. Adding `--noent` ensures
that all entities are expanded and X·Path works correctly.

GNUmakefile

index eb2a96c983d052b3456edab3bf76d7ac2525cc49..7e75a6388ba7ce74956b7d1f053da4041fb3f389 100644 (file)
@@ -291,7 +291,7 @@ override xargsquote = $(SED) $(call quote,s/'/'"'"'/g;s/^/'/;s/$$/'/;$$!s/$$/\\/
 override xargsmultiquote = $(SED) $(call quote,s/'/'"'"'/g;s/^/'/;s/$$/'/)
 
 # (callable) Test if the provided xpath expression matches the provided document.
-override xpath = $(XMLLINT) --xpath $(call quote,$1) $(call quote,$2) >>/dev/null 2>>/dev/null
+override xpath = $(XMLLINT) --noent --xpath $(call quote,$1) $(call quote,$2) >>/dev/null 2>>/dev/null
 
 # (callable) Extract the value of the text nodes in the provided X·M·L document and print them to `stdout´.
 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 - $(call quote,$1)
@@ -353,7 +353,7 @@ endif
 
 # Get the list of supported plaintext file types from the parser.
 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)))
+override plaintexttypes := $(filter-out $(XMLTYPES),$(shell $(XMLLINT) --noent --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 provided types.
@@ -486,7 +486,7 @@ endif
 # ─ ¶ Recipe Variable Definitions ─────────────────────────────────────
 
 # (callable) Get the identifier for the given parser or transform.
-override id = $(XMLLINT) --xpath '/*/*[local-name()="id" and namespace-uri()="urn:fdc:ladys.computer:20231231:Shu1She4"]/text()[1]' $(call quote,$1) 2>>/dev/null || $(PRINTF) '%s\n' $(call quote,about:shushe?$(or $2,unknown)=$(call pathenc,$(basename $(notdir $1))))
+override id = $(XMLLINT) --noent --xpath '/*/*[local-name()="id" and namespace-uri()="urn:fdc:ladys.computer:20231231:Shu1She4"]/text()[1]' $(call quote,$1) 2>>/dev/null || $(PRINTF) '%s\n' $(call quote,about:shushe?$(or $2,unknown)=$(call pathenc,$(basename $(notdir $1))))
 
 # (callable) Sanitize and wrap the provided plaintext file in X·M·L, printing to `stdout´.
 override wrapplaintext = { $(PRINTF) '%s\n%s' '<?xml version="1.0"?>' '<script xmlns="http://www.w3.org/1999/xhtml" type="$(call typeoffile,$1)"><![CDATA['; $(TR) '\000\013\014' '\032\011\012' <$(call quote,$1) | $(SED) "$$($(PRINTF) '%b' 's/]]>/]]]]><!\\[CDATA\\[>/g\ns/\0357\0277\0276/�/g\ns/\0357\0277\0277/�/g\n$$!s/\\r$$//g\ns/\\r/\\n/g\n$$!s/\0302\0205$$//g\ns/\0302\0205/\\n/g\ns/\0342\0200\0250/\\n/g\ns/[\0001\0002\0003\0004\0005\0006\0007\0010]/�/g\ns/[\0016\0017\0020\0021\0022\0023\0024\0025\0026\0027\0031\0032\0033\0034\0035\0036\0037]/�/g')"; $(PRINTF) '%s\n' ']]></script>'; }
This page took 0.066555 seconds and 4 git commands to generate.