mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #769489 (pdb file can not be converted)
This commit is contained in:
commit
d162c690a0
@ -129,14 +129,22 @@ class Reader132(FormatReader):
|
|||||||
footnoteids = re.findall('\w+(?=\x00)', self.section_data(self.header_record.footnote_offset).decode('cp1252' if self.encoding is None else self.encoding))
|
footnoteids = re.findall('\w+(?=\x00)', self.section_data(self.header_record.footnote_offset).decode('cp1252' if self.encoding is None else self.encoding))
|
||||||
for fid, i in enumerate(range(self.header_record.footnote_offset + 1, self.header_record.footnote_offset + self.header_record.footnote_count)):
|
for fid, i in enumerate(range(self.header_record.footnote_offset + 1, self.header_record.footnote_offset + self.header_record.footnote_count)):
|
||||||
self.log.debug('Extracting footnote page %i' % i)
|
self.log.debug('Extracting footnote page %i' % i)
|
||||||
html += footnote_to_html(footnoteids[fid], self.decompress_text(i))
|
if fid < len(footnoteids):
|
||||||
|
fid = footnoteids[fid]
|
||||||
|
else:
|
||||||
|
fid = ''
|
||||||
|
html += footnote_to_html(fid, self.decompress_text(i))
|
||||||
|
|
||||||
if self.header_record.sidebar_count > 0:
|
if self.header_record.sidebar_count > 0:
|
||||||
html += '<br /><h1>%s</h1>' % _('Sidebar')
|
html += '<br /><h1>%s</h1>' % _('Sidebar')
|
||||||
sidebarids = re.findall('\w+(?=\x00)', self.section_data(self.header_record.sidebar_offset).decode('cp1252' if self.encoding is None else self.encoding))
|
sidebarids = re.findall('\w+(?=\x00)', self.section_data(self.header_record.sidebar_offset).decode('cp1252' if self.encoding is None else self.encoding))
|
||||||
for sid, i in enumerate(range(self.header_record.sidebar_offset + 1, self.header_record.sidebar_offset + self.header_record.sidebar_count)):
|
for sid, i in enumerate(range(self.header_record.sidebar_offset + 1, self.header_record.sidebar_offset + self.header_record.sidebar_count)):
|
||||||
self.log.debug('Extracting sidebar page %i' % i)
|
self.log.debug('Extracting sidebar page %i' % i)
|
||||||
html += sidebar_to_html(sidebarids[sid], self.decompress_text(i))
|
if sid < len(sidebarids):
|
||||||
|
sid = sidebarids[sid]
|
||||||
|
else:
|
||||||
|
sid = ''
|
||||||
|
html += sidebar_to_html(sid, self.decompress_text(i))
|
||||||
|
|
||||||
html += '</body></html>'
|
html += '</body></html>'
|
||||||
|
|
||||||
|
@ -749,7 +749,10 @@ def pml_to_html(pml):
|
|||||||
|
|
||||||
def footnote_sidebar_to_html(pre_id, id, pml):
|
def footnote_sidebar_to_html(pre_id, id, pml):
|
||||||
id = id.strip('\x01')
|
id = id.strip('\x01')
|
||||||
html = '<br /><br style="page-break-after: always;" /><div id="%s-%s"><p>%s</p><small><a href="#r%s-%s">return</a></small></div>' % (pre_id, id, pml_to_html(pml), pre_id, id)
|
if id.strip():
|
||||||
|
html = '<br /><br style="page-break-after: always;" /><div id="%s-%s">%s<small><a href="#r%s-%s">return</a></small></div>' % (pre_id, id, pml_to_html(pml), pre_id, id)
|
||||||
|
else:
|
||||||
|
html = '<br /><br style="page-break-after: always;" /><div>%s</div>' % pml_to_html(pml)
|
||||||
return html
|
return html
|
||||||
|
|
||||||
def footnote_to_html(id, pml):
|
def footnote_to_html(id, pml):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user