Skip to content

Commit 6f2cbc9

Browse files
authored
fix(convert): --use-template fixed (#182)
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
1 parent 5bd88c2 commit 6f2cbc9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

manim_slides/convert.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def validate_config_option(
5454
class Converter(BaseModel): # type: ignore
5555
presentation_configs: List[PresentationConfig] = []
5656
assets_dir: str = "{basename}_assets"
57-
template: Optional[str] = None
57+
template: Optional[Path] = None
5858

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

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

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

0 commit comments

Comments
 (0)