Skip to content

Commit

Permalink
Refactor image metadata handling for better readability and performance
Browse files Browse the repository at this point in the history
  • Loading branch information
arash77 committed May 21, 2024
1 parent 78af8ab commit 004cc40
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/galaxy_social.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ def parse_markdown_file(self, file_path):
images = image_pattern.findall(text)
plain_content = re.sub(image_pattern, "", text).strip()

metadata["images"] = metadata.get("images", [])
for image in images:
metadata["images"].append({"url": image[1], "alt_text": image[0]})
metadata["images"] = [
{"url": image[1], "alt_text": image[0]} for image in images
]

return plain_content, metadata

Expand Down

0 comments on commit 004cc40

Please sign in to comment.