mirror of
https://github.com/kemayo/leech
synced 2025-12-06 16:33:16 +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:
parent
f933020357
commit
dca26e95ea
1 changed files with 2 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue