mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-05-22 21:17:19 +08:00
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
This commit is contained in:
@ -54,7 +54,7 @@ def validate_config_option(
|
|||||||
class Converter(BaseModel): # type: ignore
|
class Converter(BaseModel): # type: ignore
|
||||||
presentation_configs: List[PresentationConfig] = []
|
presentation_configs: List[PresentationConfig] = []
|
||||||
assets_dir: str = "{basename}_assets"
|
assets_dir: str = "{basename}_assets"
|
||||||
template: Optional[str] = None
|
template: Optional[Path] = None
|
||||||
|
|
||||||
def convert_to(self, dest: Path) -> None:
|
def convert_to(self, dest: Path) -> None:
|
||||||
"""Converts self, i.e., a list of presentations, into a given format."""
|
"""Converts self, i.e., a list of presentations, into a given format."""
|
||||||
@ -327,9 +327,8 @@ class RevealJS(Converter):
|
|||||||
|
|
||||||
def load_template(self) -> str:
|
def load_template(self) -> str:
|
||||||
"""Returns the RevealJS HTML template as a string."""
|
"""Returns the RevealJS HTML template as a string."""
|
||||||
if isinstance(self.template, str):
|
if isinstance(self.template, Path):
|
||||||
with open(self.template, "r") as f:
|
return self.template.read_text()
|
||||||
return f.read()
|
|
||||||
|
|
||||||
if sys.version_info < (3, 9):
|
if sys.version_info < (3, 9):
|
||||||
return resources.read_text(data, "revealjs_template.html")
|
return resources.read_text(data, "revealjs_template.html")
|
||||||
|
Reference in New Issue
Block a user