From a7bf3105ed7c860142ff26317a86d76af0752556 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 18 Feb 2011 19:36:02 -0700 Subject: [PATCH] LRF Input: Workaround for broken LRF files from BookDesigner that have incomplete TextStyle elements --- src/calibre/ebooks/lrf/objects.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/lrf/objects.py b/src/calibre/ebooks/lrf/objects.py index 9f0dd4211c..a83794b7b5 100644 --- a/src/calibre/ebooks/lrf/objects.py +++ b/src/calibre/ebooks/lrf/objects.py @@ -854,7 +854,8 @@ class Text(LRFStream): if len(self.content) == 0: current_style = style.copy() name, val = action[0], LRFObject.tag_to_val(action, self, tag, None) - if name and current_style[name] != val: + if name and (name not in current_style or current_style[name] + != val): # No existing Span if len(self.content) > 0 and isinstance(self.content[-1], self.__class__.Span): self.content[-1].attrs[name] = val