[SNBOutput] Fix bugs in handling <li> <img> and bookmark.

This commit is contained in:
Li Fanxi 2010-10-12 16:22:25 +08:00
parent 8f3e1ca4d5
commit f0fb8fb12a

View File

@ -206,7 +206,7 @@ class SNBMLizer(object):
if elem.attrib.get('id') != None and elem.attrib['id'] in [ href for href, title in subitems ]: if elem.attrib.get('id') != None and elem.attrib['id'] in [ href for href, title in subitems ]:
if self.curSubItem != None and self.curSubItem != elem.attrib['id']: if self.curSubItem != None and self.curSubItem != elem.attrib['id']:
self.curSubItem = elem.attrib['id'] self.curSubItem = elem.attrib['id']
text.append(u'%s%s\n\n' % (CALIBRE_SNB_BM_TAG, self.curSubItem)) text.append(u'\n\n%s%s\n\n' % (CALIBRE_SNB_BM_TAG, self.curSubItem))
if style['display'] in ('none', 'oeb-page-head', 'oeb-page-foot') \ if style['display'] in ('none', 'oeb-page-head', 'oeb-page-foot') \
or style['visibility'] == 'hidden': or style['visibility'] == 'hidden':
@ -226,13 +226,13 @@ class SNBMLizer(object):
text.append(u' ') text.append(u' ')
if tag == 'img': if tag == 'img':
text.append(u'%s%s' % (CALIBRE_SNB_IMG_TAG, ProcessFileName(elem.attrib['src']))) text.append(u'\n\n%s%s\n\n' % (CALIBRE_SNB_IMG_TAG, ProcessFileName(elem.attrib['src'])))
if tag == 'br': if tag == 'br':
text.append(u'\n\n') text.append(u'\n\n')
if tag == 'li': if tag == 'li':
li = '-- ' li = '- '
pre = (tag == 'pre' or pre) pre = (tag == 'pre' or pre)
# Process tags that contain text. # Process tags that contain text.