[SNBOutput] Fixed a bug in handling pre tag.

This commit is contained in:
Kovid Goyal 2010-11-02 12:16:27 -06:00
commit 4ee2991358

View File

@ -101,11 +101,12 @@ class SNBMLizer(object):
subitem = '' subitem = ''
bodyTree = trees[subitem].find(".//body") bodyTree = trees[subitem].find(".//body")
for line in output.splitlines(): 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') line = line.strip(u' \t\n\r\u3000')
else: else:
etree.SubElement(bodyTree, "text").text = \ etree.SubElement(bodyTree, "text").text = \
etree.CDATA(line[len(CALIBRE_SNB_PRE_TAG):]) etree.CDATA(line[pos+len(CALIBRE_SNB_PRE_TAG):])
continue continue
if len(line) != 0: if len(line) != 0:
if line.find(CALIBRE_SNB_IMG_TAG) == 0: if line.find(CALIBRE_SNB_IMG_TAG) == 0: