From 691c8b8a7c6dd8cb13f21d82e900774f4f72cfbb Mon Sep 17 00:00:00 2001 From: Oscar Levin Date: Wed, 30 Sep 2026 18:04:03 -0600 Subject: [PATCH 1/2] tweak xpath indicator for dynamic-subs --- pretext/__init__.py | 2 +- pretext/constants.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pretext/__init__.py b/pretext/__init__.py index e7e462bf..7ab983f5 100644 --- a/pretext/__init__.py +++ b/pretext/__init__.py @@ -18,7 +18,7 @@ VERSION = get_version("pretext", Path(__file__).parent.parent) -CORE_COMMIT = "20d10545401ca7b4fa820d59b78de6e88f8dce6b" +CORE_COMMIT = "cf64e2a6ed2d70d2c118306fbe8ab25e8522680f" def activate() -> None: diff --git a/pretext/constants.py b/pretext/constants.py index fbea270e..0181db28 100644 --- a/pretext/constants.py +++ b/pretext/constants.py @@ -174,7 +174,7 @@ "qrcode": ".//audio[@source|@href]|.//video[@source|@href|@youtube|@youtubeplaylist|@vimeo]|.//interactive|.//program[@interactive]", "mermaid": ".//mermaid", "myopenmath": ".//myopenmath", - "dynamic-subs": ".//statement[.//fillin and ancestor::exercise/evaluation]", + "dynamic-subs": ".//fillin[@ansobj] | .//eval[@obj]", "references": ".//biblio", "stack": ".//stack", "gdscript": ".//program[@pck]", From a975d4c0c703ef98aca8071ec22022bd4aacbbc7 Mon Sep 17 00:00:00 2001 From: Oscar Levin Date: Wed, 30 Sep 2026 18:26:12 -0600 Subject: [PATCH 2/2] hash the correct dynamic-sub asset generation part --- pretext/project/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pretext/project/__init__.py b/pretext/project/__init__.py index af5d4614..2190e35c 100644 --- a/pretext/project/__init__.py +++ b/pretext/project/__init__.py @@ -699,6 +699,15 @@ def generate_asset_table(self) -> pt.AssetTable: base_url = self._read_publication_file_subset().baseurl if base_url is not None: hash.update(base_url.encode("utf-8")) + # For dynamic substitutions, the values come from the setup code, so + # we hash it too. (It can't go in the xpath, since a setup alone + # doesn't require the substitutions file.) + if asset == "dynamic-subs": + setups = self.source_element().xpath(".//setup") + assert isinstance(setups, t.List) + for node in setups: + assert isinstance(node, ET._Element) + hash.update(ET.tostring(node)) # Finally, we store the hash as a string in the dictionary. asset_hash_dict[asset] = hash.hexdigest() return asset_hash_dict