From c171ff5549122546c1519dabb8a65b95e010f9bd Mon Sep 17 00:00:00 2001 From: Sina Atalay Date: Sun, 2 Feb 2025 18:25:03 -0500 Subject: [PATCH] Fix `render --png-path` is not copying all the png files (#332) --- rendercv/renderer/renderer.py | 11 +++-------- tests/test_cli.py | 3 ++- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/rendercv/renderer/renderer.py b/rendercv/renderer/renderer.py index 4bb1d07e..3ccc6d6e 100644 --- a/rendercv/renderer/renderer.py +++ b/rendercv/renderer/renderer.py @@ -251,15 +251,10 @@ def render_pngs_from_typst( """ typst_compiler = TypstCompiler(file_path) output_path = file_path.parent / (file_path.stem + "_{p}.png") - output = typst_compiler.run(format="png", ppi=ppi, output=output_path) + typst_compiler.run(format="png", ppi=ppi, output=output_path) - if isinstance(output, list): - return [ - output_path.parent / output_path.name.format(p=i) - for i in range(len(output)) - ] - - return [output_path.parent / output_path.name.format(p=1)] + # Look at the outtput folder and find the PNG files: + return list(output_path.parent.glob(f"{file_path.stem}_*.png")) def render_an_html_from_markdown(markdown_file_path: pathlib.Path) -> pathlib.Path: diff --git a/tests/test_cli.py b/tests/test_cli.py index a95fda8e..8dc6959a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -344,7 +344,8 @@ def test_render_command_with_custom_png_path_multiple_pages(tmp_path): ], ) - png_page_file_path = tmp_path / "test.png" + png_page_file_path = tmp_path / "test_1.png" + png_page_file_path = tmp_path / "test_2.png" assert png_page_file_path.exists()