From: Lady Date: Wed, 17 Jan 2024 06:36:01 +0000 (-0500) Subject: Remember types in parser X-Git-Tag: 0.4.0~4 X-Git-Url: https://git.ladys.computer/Shushe/commitdiff_plain/1c02c25ab49b46225f48d51ccc52648c20c82eaf?ds=sidebyside Remember types in parser Rather than derive the types from the parser via a separate transform, collect them when building the parser and remember them in a `` which can be queried with X·Path. This is a prerequisite to accessing this information at parse time, but also a useful optimization in its own right. --- diff --git a/GNUmakefile b/GNUmakefile index 2de20b2..e09da91 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -236,7 +236,7 @@ endif # Get the list of supported plaintext file types from the parser. ifneq ($(wildcard $(BUILDDIR)/parser.xslt),) -override plaintexttypes := $(filter-out $(XMLTYPES),$(shell $(XSLTPROC) $(call quote,$(THISDIR)/lib/parser2types.xslt) $(call quote,$(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 @@ -416,7 +416,7 @@ ifeq ($(wildcard $(BUILDDIR)/.update-types),) # # This recipe sleeps for one second to ensure that files built after # the restart have a more current time·stamp. -$(THISDIR)/GNUmakefile:: $(BUILDDIR)/magic.mgc $(BUILDDIR)/parser.xslt $(THISDIR)/lib/parser2types.xslt +$(THISDIR)/GNUmakefile:: $(BUILDDIR)/magic.mgc $(BUILDDIR)/parser.xslt $(silent)$(TOUCH) $(THISDIR)/GNUmakefile $(silent)$(RM) -f $(call quote,$(BUILDDIR)/dependencies) @$(PRINTF) '%b\n' '\0033[1mMagic file or parsers have updated. Restarting…\0033[22m' diff --git a/lib/catalog2parser.xslt b/lib/catalog2parser.xslt index f35fbc1..ead56da 100644 --- a/lib/catalog2parser.xslt +++ b/lib/catalog2parser.xslt @@ -10,14 +10,63 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one