From: Michał Górny Date: Wed, 29 Aug 2012 21:02:51 +0000 (+0200) Subject: FB2: fix verse handling in lyrics. X-Git-Tag: 1.7~144^2 X-Git-Url: https://git.mdrn.pl/librarian.git/commitdiff_plain/c51d51f2b1fd8d2eaa63224bb0aeac6b85ac3737?ds=sidebyside;hp=--cc FB2: fix verse handling in lyrics. Use the epub verse conversion code to convert verses to a more suitable XML format. --- c51d51f2b1fd8d2eaa63224bb0aeac6b85ac3737 diff --git a/librarian/fb2.py b/librarian/fb2.py index b0ad410..78707a9 100644 --- a/librarian/fb2.py +++ b/librarian/fb2.py @@ -8,6 +8,7 @@ from copy import deepcopy from lxml import etree from librarian import functions, OutputFile +from .epub import replace_by_verse functions.reg_substitute_entities() @@ -30,6 +31,10 @@ def transform(wldoc, verbose=False, style_filename = os.path.join(os.path.dirname(__file__), 'fb2/fb2.xslt') style = etree.parse(style_filename) + replace_by_verse(document.edoc) + result = document.transform(style) return OutputFile.from_string(unicode(result).encode('utf-8')) + +# vim:et diff --git a/librarian/fb2/poems.xslt b/librarian/fb2/poems.xslt index d276ebf..bbc9407 100644 --- a/librarian/fb2/poems.xslt +++ b/librarian/fb2/poems.xslt @@ -25,29 +25,15 @@ - - - + - - - + + - - - - - - - - - - - - + +