mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
FB2 Output: Properly indent the metadata header.
This commit is contained in:
parent
33979626b1
commit
8a09a4db03
@ -8,10 +8,9 @@ __docformat__ = 'restructuredtext en'
|
|||||||
Transform OEB content into FB2 markup
|
Transform OEB content into FB2 markup
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import re, textwrap, uuid
|
||||||
from base64 import b64encode
|
from base64 import b64encode
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import re
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
@ -165,28 +164,29 @@ class FB2MLizer(object):
|
|||||||
if key not in ('author', 'cover', 'sequence', 'keywords'):
|
if key not in ('author', 'cover', 'sequence', 'keywords'):
|
||||||
metadata[key] = prepare_string_for_xml(value)
|
metadata[key] = prepare_string_for_xml(value)
|
||||||
|
|
||||||
return (u'<FictionBook xmlns="http://www.gribuser.ru/xml/fictionbook/2.0" xmlns:xlink="http://www.w3.org/1999/xlink">'
|
return textwrap.dedent(u'''
|
||||||
'<description>'
|
<FictionBook xmlns="http://www.gribuser.ru/xml/fictionbook/2.0" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
'<title-info>'
|
<description>
|
||||||
'<genre>%(genre)s</genre>'
|
<title-info>
|
||||||
'%(author)s'
|
<genre>%(genre)s</genre>
|
||||||
'<book-title>%(title)s</book-title>'
|
%(author)s
|
||||||
'%(cover)s'
|
<book-title>%(title)s</book-title>
|
||||||
'<lang>%(lang)s</lang>'
|
%(cover)s
|
||||||
'%(keywords)s'
|
<lang>%(lang)s</lang>
|
||||||
'%(sequence)s'
|
%(keywords)s
|
||||||
'</title-info>'
|
%(sequence)s
|
||||||
'<document-info>'
|
</title-info>
|
||||||
'%(author)s'
|
<document-info>
|
||||||
'<program-used>%(appname)s %(version)s</program-used>'
|
%(author)s
|
||||||
'<date>%(date)s</date>'
|
<program-used>%(appname)s %(version)s</program-used>
|
||||||
'<id>%(id)s</id>'
|
<date>%(date)s</date>
|
||||||
'<version>1.0</version>'
|
<id>%(id)s</id>
|
||||||
'</document-info>'
|
<version>1.0</version>
|
||||||
'</description>') % metadata
|
</document-info>
|
||||||
|
</description>\n''') % metadata
|
||||||
|
|
||||||
def fb2_footer(self):
|
def fb2_footer(self):
|
||||||
return u'</FictionBook>'
|
return u'\n</FictionBook>'
|
||||||
|
|
||||||
def get_cover(self):
|
def get_cover(self):
|
||||||
from calibre.ebooks.oeb.base import OEB_RASTER_IMAGES
|
from calibre.ebooks.oeb.base import OEB_RASTER_IMAGES
|
||||||
|
Loading…
x
Reference in New Issue
Block a user