diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index 8f4739c197..a3642b0a33 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -1034,6 +1034,28 @@ class BasicNewsRecipe(object, LoggingInterface): nmassage.extend(entity_replace) return BeautifulSoup(raw, markupMassage=nmassage) + @classmethod + def adeify_images(cls, soup): + ''' + If your recipe when converted to EPUB has problems with images when + viewed in Adobe Digital Editions, call this method from within + :method:`postprocess_html`. + ''' + for item in soup.findAll('img'): + for attrib in ['height','width','border','align','style']: + if item.has_key(attrib): + del item[attrib] + oldParent = item.parent + myIndex = oldParent.contents.index(item) + item.extract() + divtag = Tag(soup,'div') + brtag = Tag(soup,'br') + oldParent.insert(myIndex,divtag) + divtag.append(item) + divtag.append(brtag) + return soup + + class CustomIndexRecipe(BasicNewsRecipe): def custom_index(self):