epub converter: update footnotes

This commit is contained in:
shirshasa
2021-07-09 12:24:36 +03:00
parent 776cf1ea12
commit 90c5587570
2 changed files with 17 additions and 5 deletions

View File

@@ -48,8 +48,15 @@ class EpubPostprocessor:
self.logger.log('Footnotes processing.')
self.footnotes = []
self.noterefs = []
for href in self.href2soup_html:
self.footnotes.extend(preprocess_footnotes(self.href2soup_html[href], self.href2soup_html))
footnotes, noterefs = preprocess_footnotes(self.href2soup_html[href], self.href2soup_html)
self.footnotes.extend(footnotes)
self.noterefs.extend(noterefs)
for i, noteref in enumerate(self.noterefs):
noteref.attrs['data-id'] = i + 1
noteref.attrs['id'] = f'footnote-{i + 1}'
self.logger.log(f'Added {len(self.footnotes)} footnotes.')
self.logger.log('TOC processing.')
self.href2subchapter_ids = defaultdict(list)