From ce9f35a6ccebd87c0b12d902bb7c2aa04787ba13 Mon Sep 17 00:00:00 2001 From: Li Fanxi Date: Mon, 1 Nov 2010 23:23:15 +0800 Subject: [PATCH] [SNBOutput] Fixed a bug in handling pre tag. --- src/calibre/ebooks/snb/snbml.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/snb/snbml.py b/src/calibre/ebooks/snb/snbml.py index d910b6751d..7c16eb5d90 100644 --- a/src/calibre/ebooks/snb/snbml.py +++ b/src/calibre/ebooks/snb/snbml.py @@ -101,11 +101,12 @@ class SNBMLizer(object): subitem = '' bodyTree = trees[subitem].find(".//body") for line in output.splitlines(): - if not line.find(CALIBRE_SNB_PRE_TAG) == 0: + pos = line.find(CALIBRE_SNB_PRE_TAG) + if pos == -1: line = line.strip(u' \t\n\r\u3000') else: etree.SubElement(bodyTree, "text").text = \ - etree.CDATA(line[len(CALIBRE_SNB_PRE_TAG):]) + etree.CDATA(line[pos+len(CALIBRE_SNB_PRE_TAG):]) continue if len(line) != 0: if line.find(CALIBRE_SNB_IMG_TAG) == 0: