RB Input: Do not generate empty title tag

This commit is contained in:
Kovid Goyal 2012-02-05 23:24:19 +05:30
parent 08c840cba3
commit abdb32e1a7

View File

@ -65,7 +65,7 @@ class Reader(object):
name = urlunquote(self.stream.read(32).strip('\x00'))
size, offset, flags = self.read_i32(), self.read_i32(), self.read_i32()
toc.append(RBToc.Item(name=name, size=size, offset=offset, flags=flags))
return toc
def get_text(self, toc_item, output_dir):
@ -89,7 +89,7 @@ class Reader(object):
output += self.stream.read(toc_item.size).decode('cp1252' if self.encoding is None else self.encoding, 'replace')
with open(os.path.join(output_dir, toc_item.name), 'wb') as html:
html.write(output.encode('utf-8'))
html.write(output.replace('<TITLE>', '<TITLE> ').encode('utf-8'))
def get_image(self, toc_item, output_dir):
if toc_item.flags != 0:
@ -105,7 +105,7 @@ class Reader(object):
self.log.debug('Extracting content from file...')
html = []
images = []
for item in self.toc:
if item.name.lower().endswith('html'):
self.log.debug('HTML item %s found...' % item.name)