From 7e7968ecd7bc48e299986090653027efbf1f3025 Mon Sep 17 00:00:00 2001 From: Montana Rowe Date: Mon, 21 Mar 2016 15:28:02 -0500 Subject: [PATCH] Show custom footnotes in epub output. --- Skripten/EOAconvert.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Skripten/EOAconvert.py b/Skripten/EOAconvert.py index aadee0e..43deda6 100755 --- a/Skripten/EOAconvert.py +++ b/Skripten/EOAconvert.py @@ -1548,15 +1548,16 @@ def bring_footnote_down_epub(footnote, footnote_name, destination): kids = list(footnote.getchildren()) if len(kids): first_child = kids[0] - first_child.text = "[%s]%s" % (footnote_name, (first_child.text or "")) + first_child.text = "[%s] %s" % (footnote_name, (first_child.text or "")) replace_footnote_with_sup(footnote) - footnote.text = "[%s]" % footnote_name + footnote.text = "[%s] " % footnote_name for kid in kids: destination.append(kid) return contentopf -for xmlChapter, groupings in zip(xmlChapters, bigfoot_data): +for xmlChapter in xmlChapters: + groupings = get_bigfoot_data(xmlChapter) xmlFootnotes = xmlChapter.findall(".//note") if len(xmlFootnotes) == 0: if not len([note for grouping, notes in groupings for note in notes]): @@ -1571,7 +1572,10 @@ def bring_footnote_down_epub(footnote, footnote_name, destination): footnote_name = str(index + 1) if "lower-latin" == grouping: footnote_name = alph_fndex(index) - contentopf = bring_footnote_down_epub(note, footnote_name, xmlNewFootnotes) + para = etree.Element("p") + para.text = "[%s] %s" % (footnote_name, note.text) + contentopf = bring_footnote_down_epub(note, footnote_name, para) + xmlNewFootnotes.append(para) notes_so_far += len(notes) intFootnoteNumber = notes_so_far + 1 for xmlFootnote in xmlFootnotes: