Skip to content

Commit

Permalink
fix path
Browse files Browse the repository at this point in the history
  • Loading branch information
rugeli committed Jul 29, 2024
1 parent 98b6f8d commit 863633a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions cellpack/autopack/writers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,18 +511,20 @@ def add_images(self, header, image_text, filepaths):
)
if len(image_text) == len(filepaths):
for i in range(len(filepaths)):
img_path = f"{self.output_image_location} / {filepaths[i].name}"
self.report_md.new_line(
self.report_md.new_inline_image(
text=image_text[i],
path=str(self.output_image_location / filepaths[i].name),
path=img_path,
)
)
else:
for i in range(len(filepaths)):
img_path = f"{self.output_image_location} / {filepaths[i].name}"
self.report_md.new_line(
self.report_md.new_inline_image(
text=image_text[0],
path=str(self.output_image_location / filepaths[i].name),
path=img_path,
)
)
self.report_md.new_line("")
Expand Down
4 changes: 2 additions & 2 deletions cellpack/tests/test_markdown_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ def test_add_image(setup_md_writer, tmp_path):
writer, report_path = setup_md_writer
header = "Test Image"
image_text = ["Image 1", "Image 2"]
filepaths = ["image1.png", "image2.png"]
filepaths = [tmp_path / "image1.png", tmp_path / "image2.png"]

for image in filepaths:
(tmp_path / image).touch()
image.touch()

writer.add_images(header, image_text, filepaths)
writer.write_file()
Expand Down

0 comments on commit 863633a

Please sign in to comment.