diff --git a/CHANGELOG.md b/CHANGELOG.md index 21c6f937..9676ba89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,14 @@ Instructions: Add a subsection under `[Unreleased]` for additions, fixes, change ## [Unreleased] +### Changed + +- The CLI now uses your assembled source in case you use "versions" for checking for some source errors and deciding whether assets must be regenerated. For example, if you change an asset in a component that is not part of a version, it will not trigger rebuilding all assets. + +### Fixed + +- Fixed a bug with the denver theme that displayed some tasks with their headings not inline. + ## [2.16.1] - 2025-04-08 Includes updates to core through commit: [7017d8f](https://github.com/PreTeXtBook/pretext/commit/7017d8fcc7005984ffc7fad81d0a37062a529a9d) diff --git a/pretext/__init__.py b/pretext/__init__.py index 3b14fe8f..af5b169e 100644 --- a/pretext/__init__.py +++ b/pretext/__init__.py @@ -18,7 +18,7 @@ VERSION = get_version("pretext", Path(__file__).parent.parent) -CORE_COMMIT = "7017d8fcc7005984ffc7fad81d0a37062a529a9d" +CORE_COMMIT = "2c3fda724738cabba04c28378f91a64a72a0e7c2" def activate() -> None: diff --git a/pretext/project/__init__.py b/pretext/project/__init__.py index 8cbf4f96..9d0bc122 100644 --- a/pretext/project/__init__.py +++ b/pretext/project/__init__.py @@ -346,12 +346,16 @@ def post_validate(self) -> None: raise ValueError( "Only one is allowed in a PreTeXt document." ) - d = d_list[0] - assert isinstance(d, str) - # Use the correct number of `../` to undo the project's `output-dir`, so the output from the build is located in the correct directory of `published/document-id`. - self.output_dir = Path( - f"{'../'*len(self._project.output_dir.parents)}published/{d}" - ) + # NB as of 2025-04-08, we are no longer setting the output directory automatically for + # Runestone targets. This must be managed by the project.ptx file or by a client script. + # The commented code below is how we used to do this. + + # d = d_list[0] + # assert isinstance(d, str) + # # Use the correct number of `../` to undo the project's `output-dir`, so the output from the build is located in the correct directory of `published/document-id`. + # self.output_dir = Path( + # f"{'../'*len(self._project.output_dir.parents)}published/{d}" + # ) else: raise ValueError( "The must be defined for the Runestone format." @@ -360,12 +364,28 @@ def post_validate(self) -> None: def source_abspath(self) -> Path: return self._project.source_abspath() / self.source - def source_element(self) -> ET._Element: + def original_source_element(self) -> ET._Element: + """ + Returns the root element of the original source document without running through pretext assembly. + """ source_doc = ET.parse(self.source_abspath()) for _ in range(25): source_doc.xinclude() + print("Type of source_doc: ", type(source_doc)) return source_doc.getroot() + def source_element(self) -> ET._Element: + """ + Returns the root element for the assembled source, after processing with the "version-only" assembly. + """ + assembled = core.assembly_internal( + xml=self.source_abspath(), + pub_file=self.publication_abspath().as_posix(), + stringparams=self.stringparams.copy(), + method="version", + ) + return assembled.getroot() + def publication_abspath(self) -> Path: return self._project.publication_abspath() / self.publication @@ -446,7 +466,7 @@ def load_asset_table(self) -> pt.AssetTable: def generate_asset_table(self) -> pt.AssetTable: """ - Returns a hash table (dictionary) with keys the asset types present in the current target's source, each with value a hash of all the assets of that type. + Returns a hash table (dictionary) with keys the asset types present in the current target's *assembled* source, each with value a hash of all the assets of that type. ex: {latex-image: , asymptote: }. NOTE: This is a change in behavior starting in 2.13; previously the keys were dictionaries mapping xml:id's to hashes of individual assets. @@ -455,7 +475,7 @@ def generate_asset_table(self) -> pt.AssetTable: ns = {"pf": "https://prefigure.org"} for asset in constants.ASSET_TO_XPATH.keys(): # everything else can be updated individually. - # get all the nodes for the asset attribute + # get all the nodes for the asset attribute (using assembled source) source_assets = self.source_element().xpath( constants.ASSET_TO_XPATH[asset], namespaces=ns ) diff --git a/pretext/resources/resource_hash_table.json b/pretext/resources/resource_hash_table.json index cebfdc73..e674cc26 100644 --- a/pretext/resources/resource_hash_table.json +++ b/pretext/resources/resource_hash_table.json @@ -116,5 +116,17 @@ "installPandoc.sh": "0dfd2cf2455efeff82293ba2b3724bc94e20620ed9f87c4cd3ee967d0dedd076", "installLatex.sh": "89fc36da1ac5bf3c79e70990d760f288b94afb71dac03f0651424efbf55663aa", "installSage.sh": "7f2b791271aaf21a0b6c742e9758d4f131b59216c261902fe43c8461143cb407" + }, + "2.16.2": { + "project.ptx": "72285565f5bcd94eedb2b91f88cea37e7af21604bcb5eb9e99c286fe1291ebb3", + "codechat_config.yaml": "2fb7c39582a71b878d6d5105b5ac5dae51d5c4f4ee3354f50ba0a9dfe80ce70c", + ".gitignore": "c9dd727d2357c9c7d8022a688ae71f17d17aa2d70bccf978cb366b49b43feda2", + "devcontainer.json": "ae45a61196b3121a5644ddf4dec62843a9178185e6f9cd8ed4d6e0bcaa6f24b9", + "pretext-cli.yml": "b9bb9deb5e64ed8fa2fe472688029ae4f77731cf6a006a5c58c80c55bdb85131", + "pretext-deploy.yml": "dbf18a18cf30b9301fff84890ad99334ba08f6ab0cdfa88b5d0cb233fc378c60", + "installPretext.sh": "0bab8bf900bd81c83039656740082742afea4c99f577324d5498ae7e8644073d", + "installPandoc.sh": "b36cfab7b0a9c0536777aea982e466186184d0f317867f598e06709bf4332b75", + "installLatex.sh": "1fa5ba1cbf5d7f0d5dc71e988558281fc16e4a131b09ae9fe917b5c692e08a47", + "installSage.sh": "797938aeab7a1f2e109e40a3f116f0c66fe96e49af59968833ede70a786130ff" } } \ No newline at end of file diff --git a/templates/.gitignore b/templates/.gitignore index f8c81b9a..cd0a7826 100644 --- a/templates/.gitignore +++ b/templates/.gitignore @@ -1,4 +1,4 @@ -# This file was automatically generated with PreTeXt 2.16.1. +# This file was automatically generated with PreTeXt 2.16.2. # If you modify this file, PreTeXt will no longer automatically update it. # # Boilerplate list of files in a PreTeXt project for git to ignore diff --git a/templates/codechat_config.yaml b/templates/codechat_config.yaml index 9eb86658..75f8c584 100644 --- a/templates/codechat_config.yaml +++ b/templates/codechat_config.yaml @@ -1,4 +1,4 @@ -# This file was automatically generated with PreTeXt 2.16.1. +# This file was automatically generated with PreTeXt 2.16.2. # If you modify this file, PreTeXt will no longer automatically update it. # ############################################################# diff --git a/templates/devcontainer.json b/templates/devcontainer.json index 0aaa72f4..b6dc76b5 100644 --- a/templates/devcontainer.json +++ b/templates/devcontainer.json @@ -1,4 +1,4 @@ -// This file was automatically generated with PreTeXt 2.16.1. +// This file was automatically generated with PreTeXt 2.16.2. // If you modify this file, PreTeXt will no longer automatically update it. // ////////////////////////////////////////////////////////////// diff --git a/templates/installLatex.sh b/templates/installLatex.sh index 41da148f..17980157 100644 --- a/templates/installLatex.sh +++ b/templates/installLatex.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash -# This file was automatically generated with PreTeXt 2.16.1. +# This file was automatically generated with PreTeXt 2.16.2. # If you modify this file, PreTeXt will no longer automatically update it. # We use TinyTeX (https://yihui.org/tinytex/) wget -qO- "https://yihui.org/tinytex/install-bin-unix.sh" | sh -tlmgr install adjustbox amscdx bold-extra braket bussproofs cancel carlisle cases chessfss circuitikz colortbl enumitem extpfeil fontawesome5 fontaxes gensymb imakeidx kastrup lambda-lists listings listingsutf8 marvosym mathalpha mathtools menukeys mhchem microtype musicography newpx newtx nicematrix pdfcol pdfpages pdflscape pgfplots phaistos physics polyglossia pstricks realscripts relsize siunitx skak skaknew smartdiagram snapshot stmaryrd tcolorbox tikzfill titlesec txfonts ulem upquote was xfrac xltxtra xpatch xstring +tlmgr install adjustbox amscdx bold-extra braket bussproofs cancel carlisle cases chessfss circuitikz colortbl enumitem extpfeil fontawesome5 fontaxes gensymb imakeidx jknapltx kastrup lambda-lists listings listingsutf8 marvosym mathalpha mathtools menukeys mhchem microtype musicography newpx newtx nicematrix pdfcol pdfpages pdflscape pgfplots phaistos physics polyglossia pstricks realscripts relsize siunitx skak skaknew smartdiagram snapshot stmaryrd tcolorbox tikzfill titlesec txfonts ulem upquote was xfrac xltxtra xpatch xstring tlmgr path add diff --git a/templates/installPandoc.sh b/templates/installPandoc.sh index 063e4300..486a2622 100644 --- a/templates/installPandoc.sh +++ b/templates/installPandoc.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# This file was automatically generated with PreTeXt 2.16.1. +# This file was automatically generated with PreTeXt 2.16.2. # If you modify this file, PreTeXt will no longer automatically update it. wget https://github.com/jgm/pandoc/releases/download/3.6.4/pandoc-3.6.4-1-amd64.deb -O pandoc.deb diff --git a/templates/installPretext.sh b/templates/installPretext.sh index a3700490..ba2d11b8 100644 --- a/templates/installPretext.sh +++ b/templates/installPretext.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# This file was automatically generated with PreTeXt 2.16.1. +# This file was automatically generated with PreTeXt 2.16.2. # If you modify this file, PreTeXt will no longer automatically update it. sudo apt-get update diff --git a/templates/installSage.sh b/templates/installSage.sh index b37999bc..7e6c7bdd 100644 --- a/templates/installSage.sh +++ b/templates/installSage.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# This file was automatically generated with PreTeXt 2.16.1. +# This file was automatically generated with PreTeXt 2.16.2. # If you modify this file, PreTeXt will no longer automatically update it. # Conda should already be installed in the codespace. We need to add the conda-forge channel diff --git a/templates/pretext-cli.yml b/templates/pretext-cli.yml index 88348c6b..725f7cb7 100644 --- a/templates/pretext-cli.yml +++ b/templates/pretext-cli.yml @@ -1,4 +1,4 @@ -# This file was automatically generated with PreTeXt 2.16.1. +# This file was automatically generated with PreTeXt 2.16.2. # If you modify this file, PreTeXt will no longer automatically update it. # # This workflow file can be used to automatically build a project and create diff --git a/templates/pretext-deploy.yml b/templates/pretext-deploy.yml index 717f4980..805e2a84 100644 --- a/templates/pretext-deploy.yml +++ b/templates/pretext-deploy.yml @@ -1,4 +1,4 @@ -# This file was automatically generated with PreTeXt 2.16.1. +# This file was automatically generated with PreTeXt 2.16.2. # If you modify this file, PreTeXt will no longer automatically update it. # diff --git a/templates/project.ptx b/templates/project.ptx index 97e2a1a6..23865444 100644 --- a/templates/project.ptx +++ b/templates/project.ptx @@ -1,5 +1,5 @@ - + diff --git a/tests/test_project.py b/tests/test_project.py index e87929c7..27fb53b6 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -102,7 +102,7 @@ def test_manifest_simple(tmp_path: Path) -> None: assert t_rune.platform == "runestone" assert t_rune.output_dir_abspath().resolve().relative_to( project.abspath() - ) == Path("published/runestone-document-id") + ) == Path("output/rs") assert not project.has_target("foo") @@ -120,12 +120,8 @@ def test_manifest_simple_build(tmp_path: Path) -> None: project.get_target("web").build() assert (prj_path / "output" / "web" / "index.html").exists() project.get_target("rs").build() - assert ( - prj_path / "published" / "runestone-document-id" / "index.html" - ).exists() - assert ( - prj_path / "published" / "runestone-document-id" / "runestone-manifest.xml" - ).exists() + assert (prj_path / "output" / "rs" / "index.html").exists() + assert (prj_path / "output" / "rs" / "runestone-manifest.xml").exists() if HAS_XELATEX: project.get_target("print").build() assert (prj_path / "output" / "print" / "main.pdf").exists()