Skip to content

Commit

Permalink
fix(convert): --use-template fixed (#182)
Browse files Browse the repository at this point in the history
As described in #181, there was a mismatch between the type return by `click` and the one used by `pydantic`. Now we only use `Path` types.

Closes #181
  • Loading branch information
jeertmans authored May 8, 2023
1 parent 5bd88c2 commit 6f2cbc9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions manim_slides/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def validate_config_option(
class Converter(BaseModel): # type: ignore
presentation_configs: List[PresentationConfig] = []
assets_dir: str = "{basename}_assets"
template: Optional[str] = None
template: Optional[Path] = None

def convert_to(self, dest: Path) -> None:
"""Converts self, i.e., a list of presentations, into a given format."""
Expand Down Expand Up @@ -327,9 +327,8 @@ def get_sections_iter(self, assets_dir: Path) -> Generator[str, None, None]:

def load_template(self) -> str:
"""Returns the RevealJS HTML template as a string."""
if isinstance(self.template, str):
with open(self.template, "r") as f:
return f.read()
if isinstance(self.template, Path):
return self.template.read_text()

if sys.version_info < (3, 9):
return resources.read_text(data, "revealjs_template.html")
Expand Down

0 comments on commit 6f2cbc9

Please sign in to comment.