mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Fix #2256 (Interresting bug with epub format)
This commit is contained in:
parent
3e12e32721
commit
66809fb86d
@ -1034,6 +1034,28 @@ class BasicNewsRecipe(object, LoggingInterface):
|
|||||||
nmassage.extend(entity_replace)
|
nmassage.extend(entity_replace)
|
||||||
return BeautifulSoup(raw, markupMassage=nmassage)
|
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):
|
class CustomIndexRecipe(BasicNewsRecipe):
|
||||||
|
|
||||||
def custom_index(self):
|
def custom_index(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user