mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
MOBI Output: When using the insert metadata at start of book, do not use a table to layout the metadata, as the Kindle Fire crashes when rendering the table. Fixes #1002119 (calibre created mobi crashes on k fire if insert metadata jacket used)
This commit is contained in:
parent
fc76cae3fa
commit
4fa52d1ade
@ -223,6 +223,8 @@ class MOBIOutput(OutputFormatPlugin):
|
||||
else:
|
||||
# Add rasterized SVG images
|
||||
resources.add_extra_images()
|
||||
if hasattr(self.oeb, 'inserted_metadata_jacket'):
|
||||
self.workaround_fire_bugs(self.oeb.inserted_metadata_jacket)
|
||||
mobimlizer = MobiMLizer(ignore_tables=opts.linearize_tables)
|
||||
mobimlizer(oeb, opts)
|
||||
write_page_breaks_after_item = input_plugin is not plugin_for_input_format('cbz')
|
||||
@ -236,6 +238,18 @@ class MOBIOutput(OutputFormatPlugin):
|
||||
from calibre.ebooks.mobi.writer8.cleanup import CSSCleanup
|
||||
CSSCleanup(log, opts)(item, stylizer)
|
||||
|
||||
def workaround_fire_bugs(self, jacket):
|
||||
# The idiotic Fire crashes when trying to render the table used to
|
||||
# layout the jacket
|
||||
from calibre.ebooks.oeb.base import XHTML
|
||||
for table in jacket.data.xpath('//*[local-name()="table"]'):
|
||||
table.tag = XHTML('div')
|
||||
for tr in table.xpath('descendant::*[local-name()="tr"]'):
|
||||
cols = tr.xpath('descendant::*[local-name()="td"]')
|
||||
tr.tag = XHTML('div')
|
||||
for td in cols:
|
||||
td.tag = XHTML('span' if cols else 'div')
|
||||
|
||||
class AZW3Output(OutputFormatPlugin):
|
||||
|
||||
name = 'AZW3 Output'
|
||||
|
@ -72,6 +72,7 @@ class Jacket(object):
|
||||
|
||||
item = self.oeb.manifest.add(id, href, guess_type(href)[0], data=root)
|
||||
self.oeb.spine.insert(0, item, True)
|
||||
self.oeb.inserted_metadata_jacket = item
|
||||
|
||||
def remove_existing_jacket(self):
|
||||
for x in self.oeb.spine[:4]:
|
||||
|
Loading…
x
Reference in New Issue
Block a user