mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
PDF Input: Add dummy alt text to images to silence the egregious epubcheck
This commit is contained in:
parent
058353b278
commit
325ced46cb
@ -172,4 +172,13 @@ def flip_images(raw):
|
||||
continue
|
||||
flip_image(img, flip)
|
||||
raw = re.sub(r'<STYLE.+?</STYLE>\s*', '', raw, flags=re.I|re.DOTALL)
|
||||
|
||||
counter = 0
|
||||
|
||||
def add_alt(m):
|
||||
nonlocal counter
|
||||
counter += 1
|
||||
return m.group(1).rstrip('/') + f' alt="Image {counter}"/>'
|
||||
|
||||
raw = re.sub('(<IMG[^>]+)/?>', add_alt, raw, flags=re.I)
|
||||
return raw
|
||||
|
Loading…
x
Reference in New Issue
Block a user