Skip to content

Commit

Permalink
chore(lib): do not include reversed files in HTML assets (#336)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
jeertmans and pre-commit-ci[bot] authored Dec 11, 2023
1 parent 74ddefe commit ea2d352
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions manim_slides/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@ def to_file(self, path: Path) -> None:
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
Expand All @@ -320,7 +322,7 @@ def copy_to(self, folder: Path, use_cached: bool = True) -> "PresentationConfig"
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
Expand Down
2 changes: 1 addition & 1 deletion manim_slides/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def convert_to(self, dest: Path) -> None:
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)

Expand Down

0 comments on commit ea2d352

Please sign in to comment.