1
0
Fork 0
mirror of https://github.com/kemayo/leech synced 2025-12-06 08:22:56 +01:00

feat(ebook/__init__.py): leech checks if an image has an alt attribute and adds one if it doesn't

This commit is contained in:
Emmanuel Jemeni 2023-02-22 21:27:01 +01:00 committed by David Lynch
parent f933020357
commit dca26e95ea

View file

@ -97,6 +97,8 @@ def chapter_html(story, titleprefix=None, normalize=False):
content_type='image/png'
))
img['src'] = f"../images/ch{i}_leechimage_{count}.png"
if not img.has_attr('alt'):
img['alt'] = f"Image {count} from chapter {i}"
# Add all pictures on this chapter as well.
for image in chapter.images:
# For/else syntax, check if the image path already exists, if it doesn't add the image.