Yes, that is what the code Doitsu wrote does. If you do not want to delete pages with img tags and or svg tags then you need to modify that code to check for those tags before deleting.
Something like the following modification to Doitsu's code could be used to detect img and svg tags and prevent deletion if either is found:
Code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sigil_bs4 import BeautifulSoup
def run(bk):
for html_id, href in bk.text_iter():
html = bk.readfile(html_id)
soup = BeautifulSoup(html, 'html.parser')
body_text = soup.body.text.strip()
node = soup.body
if body_text == '' or len(body_text) <= 6:
if not node.img and not node.svg:
print('INFO: Removing {}... '.format(href))
bk.deletefile(html_id)
print('\nPlease click OK to close the Plugin Runner window.')
return 0
def main():
print("I reached main when I should not have\n")
return -1
if __name__ == "__main__":
sys.exit(main())
Please note: I did NOT test this at all because all I have access to is an ipad.