X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/d9dc96ea261fdeed57bbb57c4405003893668d8d..3b0b98465bc1862306b05bb8305a1abbf40ca310:/librarian/fb2.py?ds=inline diff --git a/librarian/fb2.py b/librarian/fb2.py index d979566..bc1504d 100644 --- a/librarian/fb2.py +++ b/librarian/fb2.py @@ -7,7 +7,7 @@ import os.path from copy import deepcopy from lxml import etree -from librarian import functions, OutputFile +from librarian import functions, IOFile from .epub import replace_by_verse @@ -17,10 +17,11 @@ functions.reg_person_name() def sectionify(tree): """Finds section headers and adds a tree of _section tags.""" - sections = ['naglowek_czesc', - 'naglowek_akt', 'naglowek_rozdzial', 'naglowek_scena', - 'naglowek_podrozdzial'] - section_level = dict((v,k) for (k,v) in enumerate(sections)) + sections = [ + 'naglowek_czesc', + 'naglowek_akt', 'naglowek_rozdzial', 'naglowek_scena', + 'naglowek_podrozdzial'] + section_level = {v: k for (k, v) in enumerate(sections)} # We can assume there are just subelements an no text at section level. for level, section_name in reversed(list(enumerate(sections))): @@ -58,6 +59,6 @@ def transform(wldoc, verbose=False, result = document.transform(style) - return OutputFile.from_string(unicode(result).encode('utf-8')) + return IOFile.from_string(unicode(result).encode('utf-8')) # vim:et