From 61504a852710095ce67ca7692a98490715416d0c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 16 Jun 2010 12:03:46 -0600 Subject: [PATCH] Fix #5830 (problem -- underline in MOBI format) --- src/calibre/ebooks/mobi/mobiml.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/mobi/mobiml.py b/src/calibre/ebooks/mobi/mobiml.py index 9361d52d31..bfa8758c85 100644 --- a/src/calibre/ebooks/mobi/mobiml.py +++ b/src/calibre/ebooks/mobi/mobiml.py @@ -61,6 +61,7 @@ class FormatState(object): self.italic = False self.bold = False self.strikethrough = False + self.underline = False self.preserve = False self.family = 'serif' self.bgcolor = 'transparent' @@ -79,7 +80,8 @@ class FormatState(object): and self.family == other.family \ and self.bgcolor == other.bgcolor \ and self.fgcolor == other.fgcolor \ - and self.strikethrough == other.strikethrough + and self.strikethrough == other.strikethrough \ + and self.underline == other.underline def __ne__(self, other): return not self.__eq__(other) @@ -251,6 +253,8 @@ class MobiMLizer(object): color=unicode(istate.fgcolor)) if istate.strikethrough: inline = etree.SubElement(inline, XHTML('s')) + if istate.underline: + inline = etree.SubElement(inline, XHTML('u')) bstate.inline = inline bstate.istate = istate inline = bstate.inline @@ -330,6 +334,7 @@ class MobiMLizer(object): istate.bgcolor = style['background-color'] istate.fgcolor = style['color'] istate.strikethrough = style['text-decoration'] == 'line-through' + istate.underline = style['text-decoration'] == 'underline' if 'monospace' in style['font-family']: istate.family = 'monospace' elif 'sans-serif' in style['font-family']: