MOBI Output: When generating joint MOBI6/KF8 files do not set incorrect display CSS values for tables in the KF8 part

This commit is contained in:
Kovid Goyal 2012-11-19 23:18:20 +05:30
parent af632bed91
commit d00e92d16a
2 changed files with 10 additions and 2 deletions

View File

@ -1103,10 +1103,14 @@ OptionRecommendation(name='search_replace',
from calibre.ebooks.oeb.transforms.unsmarten import UnsmartenPunctuation from calibre.ebooks.oeb.transforms.unsmarten import UnsmartenPunctuation
UnsmartenPunctuation()(self.oeb, self.opts) UnsmartenPunctuation()(self.oeb, self.opts)
mobi_file_type = getattr(self.opts, 'mobi_file_type', 'old')
needs_old_markup = (self.output_plugin.file_type == 'lit' or
(self.output_plugin.file_type == 'mobi' and mobi_file_type
== 'old'))
flattener = CSSFlattener(fbase=fbase, fkey=fkey, flattener = CSSFlattener(fbase=fbase, fkey=fkey,
lineh=line_height, lineh=line_height,
untable=self.output_plugin.file_type in ('mobi','lit'), untable=needs_old_markup,
unfloat=self.output_plugin.file_type in ('mobi', 'lit'), unfloat=needs_old_markup,
page_break_on_body=self.output_plugin.file_type in ('mobi', page_break_on_body=self.output_plugin.file_type in ('mobi',
'lit'), 'lit'),
specializer=partial(self.output_plugin.specialize_css_for_output, specializer=partial(self.output_plugin.specialize_css_for_output,

View File

@ -322,6 +322,10 @@ class MobiMLizer(object):
istates.append(istate) istates.append(istate)
left = 0 left = 0
display = style['display'] display = style['display']
if display == 'table-cell':
display = 'inline'
elif display.startswith('table'):
display = 'block'
isblock = (not display.startswith('inline') and style['display'] != isblock = (not display.startswith('inline') and style['display'] !=
'none') 'none')
isblock = isblock and style['float'] == 'none' isblock = isblock and style['float'] == 'none'