Skip to content

Commit

Permalink
fix: fix bug and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeX4 committed May 28, 2024
1 parent c17d561 commit c1f4f50
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "touying"
version = "0.11.1"
version = "0.11.2"
description = "Export presentation slides in various formats for Touying"
readme = "README.md"
keywords = ["presentation", "slides", "export"]
Expand Down
19 changes: 19 additions & 0 deletions touying/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ def to_html(
if output is None:
output = Path(input).with_suffix(".html")

# create output directory if it doesn't exist
output_dir = Path(output).parent
if not output_dir.exists():
output_dir.mkdir(parents=True)

with open(output, "w", encoding="utf8") as f:
f.write(result)

Expand Down Expand Up @@ -149,6 +154,11 @@ def to_pptx(
# save presentation
prs.save(output)

# create output directory if it doesn't exist
output_dir = Path(output).parent
if not output_dir.exists():
output_dir.mkdir(parents=True)

if not silent:
print(f"Presentation saved to {output}")

Expand All @@ -158,6 +168,10 @@ def to_pdf(input, output=None, root=None, font_paths=[], silent=False):
print(f"Compiling typst source file {input}...")
if output is None:
output = Path(input).with_suffix(".pdf")
# create output directory if it doesn't exist
output_dir = Path(output).parent
if not output_dir.exists():
output_dir.mkdir(parents=True)
typst.compile(input, output=output, root=root, font_paths=font_paths, format="pdf")


Expand All @@ -169,6 +183,11 @@ def to_pdfpc(input, output=None, root=None, font_paths=[], silent=False):
if output is None:
output = Path(input).with_suffix(".pdfpc")

# create output directory if it doesn't exist
output_dir = Path(output).parent
if not output_dir.exists():
output_dir.mkdir(parents=True)

with open(output, "w", encoding="utf8") as f:
f.write(
typst.query(
Expand Down

0 comments on commit c1f4f50

Please sign in to comment.