mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
FB2 Output: Dedent the header to position it on the same level as the body
This commit is contained in:
parent
8b11947309
commit
abe408bc39
@ -200,32 +200,33 @@ class FB2MLizer(object):
|
|||||||
from calibre.utils.html2text import html2text
|
from calibre.utils.html2text import html2text
|
||||||
metadata['comments'] = '<annotation><p>{}</p></annotation>'.format(prepare_string_for_xml(html2text(comments.value).strip()))
|
metadata['comments'] = '<annotation><p>{}</p></annotation>'.format(prepare_string_for_xml(html2text(comments.value).strip()))
|
||||||
|
|
||||||
|
# Keep the indentation level of the description the same as the body.
|
||||||
header = textwrap.dedent('''\
|
header = textwrap.dedent('''\
|
||||||
<FictionBook xmlns="http://www.gribuser.ru/xml/fictionbook/2.0" xmlns:l="http://www.w3.org/1999/xlink">
|
<FictionBook xmlns="http://www.gribuser.ru/xml/fictionbook/2.0" xmlns:l="http://www.w3.org/1999/xlink">
|
||||||
<description>
|
<description>
|
||||||
<title-info>
|
<title-info>
|
||||||
<genre>%(genre)s</genre>
|
<genre>%(genre)s</genre>
|
||||||
%(author)s
|
%(author)s
|
||||||
<book-title>%(title)s</book-title>
|
<book-title>%(title)s</book-title>
|
||||||
%(cover)s
|
%(cover)s
|
||||||
<lang>%(lang)s</lang>
|
<lang>%(lang)s</lang>
|
||||||
%(keywords)s
|
%(keywords)s
|
||||||
%(sequence)s
|
%(sequence)s
|
||||||
%(comments)s
|
%(comments)s
|
||||||
</title-info>
|
</title-info>
|
||||||
<document-info>
|
<document-info>
|
||||||
%(author)s
|
%(author)s
|
||||||
<program-used>%(appname)s %(version)s</program-used>
|
<program-used>%(appname)s %(version)s</program-used>
|
||||||
<date>%(date)s</date>
|
<date>%(date)s</date>
|
||||||
<id>%(id)s</id>
|
<id>%(id)s</id>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
</document-info>
|
</document-info>
|
||||||
<publish-info>
|
<publish-info>
|
||||||
%(publisher)s
|
%(publisher)s
|
||||||
%(year)s
|
%(year)s
|
||||||
%(isbn)s
|
%(isbn)s
|
||||||
</publish-info>
|
</publish-info>
|
||||||
</description>''') % metadata
|
</description>''') % metadata
|
||||||
|
|
||||||
# Remove empty lines.
|
# Remove empty lines.
|
||||||
return '\n'.join(filter(unicode_type.strip, header.splitlines()))
|
return '\n'.join(filter(unicode_type.strip, header.splitlines()))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user