mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Kovid's fix for white and strikethrough text
This commit is contained in:
parent
543050779c
commit
34f42fd225
@ -60,9 +60,11 @@ class FormatState(object):
|
|||||||
self.valign = 'baseline'
|
self.valign = 'baseline'
|
||||||
self.italic = False
|
self.italic = False
|
||||||
self.bold = False
|
self.bold = False
|
||||||
|
self.strikethrough = False
|
||||||
self.preserve = False
|
self.preserve = False
|
||||||
self.family = 'serif'
|
self.family = 'serif'
|
||||||
self.bgcolor = 'transparent'
|
self.bgcolor = 'transparent'
|
||||||
|
self.fgcolor = 'black'
|
||||||
self.href = None
|
self.href = None
|
||||||
self.list_num = 0
|
self.list_num = 0
|
||||||
self.attrib = {}
|
self.attrib = {}
|
||||||
@ -75,7 +77,9 @@ class FormatState(object):
|
|||||||
and self.valign == other.valign \
|
and self.valign == other.valign \
|
||||||
and self.preserve == other.preserve \
|
and self.preserve == other.preserve \
|
||||||
and self.family == other.family \
|
and self.family == other.family \
|
||||||
and self.bgcolor == other.bgcolor
|
and self.bgcolor == other.bgcolor \
|
||||||
|
and self.fgcolor == other.fgcolor \
|
||||||
|
and self.strikethrough == other.strikethrough
|
||||||
|
|
||||||
def __ne__(self, other):
|
def __ne__(self, other):
|
||||||
return not self.__eq__(other)
|
return not self.__eq__(other)
|
||||||
@ -239,6 +243,11 @@ class MobiMLizer(object):
|
|||||||
if istate.bgcolor is not None and istate.bgcolor != 'transparent' :
|
if istate.bgcolor is not None and istate.bgcolor != 'transparent' :
|
||||||
inline = etree.SubElement(inline, XHTML('span'),
|
inline = etree.SubElement(inline, XHTML('span'),
|
||||||
bgcolor=istate.bgcolor)
|
bgcolor=istate.bgcolor)
|
||||||
|
if istate.fgcolor != 'black':
|
||||||
|
inline = etree.SubElement(inline, XHTML('font'),
|
||||||
|
color=istate.fgcolor)
|
||||||
|
if istate.strikethrough:
|
||||||
|
inline = etree.SubElement(inline, XHTML('s'))
|
||||||
bstate.inline = inline
|
bstate.inline = inline
|
||||||
bstate.istate = istate
|
bstate.istate = istate
|
||||||
inline = bstate.inline
|
inline = bstate.inline
|
||||||
@ -316,6 +325,8 @@ class MobiMLizer(object):
|
|||||||
istate.bold = weight in ('bold', 'bolder') or asfloat(weight) > 400
|
istate.bold = weight in ('bold', 'bolder') or asfloat(weight) > 400
|
||||||
istate.preserve = (style['white-space'] in ('pre', 'pre-wrap'))
|
istate.preserve = (style['white-space'] in ('pre', 'pre-wrap'))
|
||||||
istate.bgcolor = style['background-color']
|
istate.bgcolor = style['background-color']
|
||||||
|
istate.fgcolor = style['color']
|
||||||
|
istate.strikethrough = style['text-decoration'] == 'line-through'
|
||||||
if 'monospace' in style['font-family']:
|
if 'monospace' in style['font-family']:
|
||||||
istate.family = 'monospace'
|
istate.family = 'monospace'
|
||||||
elif 'sans-serif' in style['font-family']:
|
elif 'sans-serif' in style['font-family']:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user