mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-28 03:43:11 +02:00
FB2 Output: Remove empty lines from header
This commit is contained in:
parent
906b8773c5
commit
62757eadff
1 changed files with 7 additions and 4 deletions
|
|
@ -19,7 +19,7 @@
|
|||
from calibre.utils.localization import lang_as_iso639_1
|
||||
from calibre.utils.img import save_cover_data_to
|
||||
from calibre.ebooks.oeb.base import urlnormalize
|
||||
from polyglot.builtins import unicode_type, string_or_bytes, range
|
||||
from polyglot.builtins import unicode_type, string_or_bytes, range, filter
|
||||
from polyglot.binary import as_base64_unicode
|
||||
|
||||
|
||||
|
|
@ -195,12 +195,12 @@ def fb2_header(self):
|
|||
from calibre.utils.html2text import html2text
|
||||
metadata['comments'] = '<annotation>{}</annotation>'.format(prepare_string_for_xml(html2text(comments.value.strip())))
|
||||
|
||||
return textwrap.dedent('''
|
||||
header = textwrap.dedent('''\
|
||||
<FictionBook xmlns="http://www.gribuser.ru/xml/fictionbook/2.0" xmlns:l="http://www.w3.org/1999/xlink">
|
||||
<description>
|
||||
<title-info>
|
||||
<genre>%(genre)s</genre>
|
||||
%(author)s
|
||||
%(author)s
|
||||
<book-title>%(title)s</book-title>
|
||||
%(cover)s
|
||||
<lang>%(lang)s</lang>
|
||||
|
|
@ -220,7 +220,10 @@ def fb2_header(self):
|
|||
%(year)s
|
||||
%(isbn)s
|
||||
</publish-info>
|
||||
</description>\n''') % metadata
|
||||
</description>''') % metadata
|
||||
|
||||
# Remove empty lines.
|
||||
return '\n'.join(filter(unicode_type.strip, header.splitlines())) + '\n'
|
||||
|
||||
def fb2_footer(self):
|
||||
return '</FictionBook>'
|
||||
|
|
|
|||
Loading…
Reference in a new issue