From c51d51f2b1fd8d2eaa63224bb0aeac6b85ac3737 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 29 Aug 2012 23:02:51 +0200 Subject: [PATCH 1/1] FB2: fix verse handling in lyrics. Use the epub verse conversion code to convert verses to a more suitable XML format. --- librarian/fb2.py | 5 +++++ librarian/fb2/poems.xslt | 26 ++++++-------------------- 2 files changed, 11 insertions(+), 20 deletions(-) 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 @@ - - - + - - - + + - - - - - - - - - - - - + + -- 2.20.1