From ea2d352fc1e112227be6be2cdacbb0a6d1ef85a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Mon, 11 Dec 2023 13:58:39 +0100 Subject: [PATCH] chore(lib): do not include reversed files in HTML assets (#336) * chore(lib): do not include reversed files in HTML assets * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- CHANGELOG.md | 2 ++ manim_slides/config.py | 6 ++++-- manim_slides/convert.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a799d6..7204018 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Modified the internal logic to simplify adding configuration options. [#321](https://github.com/jeertmans/manim-slides/pull/321) +- Remove `reversed` file assets when exporting to HTML, as it was not used. + [#336](https://github.com/jeertmans/manim-slides/pull/336) (v5.1-chore)= ### Chore diff --git a/manim_slides/config.py b/manim_slides/config.py index d9e4475..ad401c5 100644 --- a/manim_slides/config.py +++ b/manim_slides/config.py @@ -305,7 +305,9 @@ class PresentationConfig(BaseModel): # type: ignore[misc] with open(path, "w") as f: f.write(self.model_dump_json(indent=2)) - def copy_to(self, folder: Path, use_cached: bool = True) -> "PresentationConfig": + def copy_to( + self, folder: Path, use_cached: bool = True, include_reversed: bool = True + ) -> "PresentationConfig": """Copy the files to a given directory.""" for slide_config in self.slides: file = slide_config.file @@ -320,7 +322,7 @@ class PresentationConfig(BaseModel): # type: ignore[misc] if not use_cached or not dest.exists(): shutil.copy(file, dest) - if not use_cached or not rev_dest.exists(): + if include_reversed and (not use_cached or not rev_dest.exists()): shutil.copy(rev_file, rev_dest) return self diff --git a/manim_slides/convert.py b/manim_slides/convert.py index 282ffb2..bf51415 100644 --- a/manim_slides/convert.py +++ b/manim_slides/convert.py @@ -396,7 +396,7 @@ class RevealJS(Converter): full_assets_dir.mkdir(parents=True, exist_ok=True) for presentation_config in self.presentation_configs: - presentation_config.copy_to(full_assets_dir) + presentation_config.copy_to(full_assets_dir, include_reversed=False) dest.parent.mkdir(parents=True, exist_ok=True)