mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
FB2 Output: Include tags in metadata as <keywords>. Fixes #1174047 (keywords tag not created on FB2 creation)
This commit is contained in:
parent
2b3a91335a
commit
33979626b1
@ -139,6 +139,12 @@ class FB2MLizer(object):
|
|||||||
if not metadata['author']:
|
if not metadata['author']:
|
||||||
metadata['author'] = u'<author><first-name></first-name><last-name><last-name></author>'
|
metadata['author'] = u'<author><first-name></first-name><last-name><last-name></author>'
|
||||||
|
|
||||||
|
metadata['keywords'] = u''
|
||||||
|
tags = list(map(unicode, self.oeb_book.metadata.subject))
|
||||||
|
if tags:
|
||||||
|
tags = ', '.join(prepare_string_for_xml(x) for x in tags)
|
||||||
|
metadata['keywords'] = '<keywords>%s</keywords>'%tags
|
||||||
|
|
||||||
metadata['sequence'] = u''
|
metadata['sequence'] = u''
|
||||||
if self.oeb_book.metadata.series:
|
if self.oeb_book.metadata.series:
|
||||||
index = '1'
|
index = '1'
|
||||||
@ -156,27 +162,28 @@ class FB2MLizer(object):
|
|||||||
metadata['id'] = str(uuid.uuid4())
|
metadata['id'] = str(uuid.uuid4())
|
||||||
|
|
||||||
for key, value in metadata.items():
|
for key, value in metadata.items():
|
||||||
if key not in ('author', 'cover', 'sequence'):
|
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 (u'<FictionBook xmlns="http://www.gribuser.ru/xml/fictionbook/2.0" xmlns:xlink="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>'
|
||||||
'%(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>') % metadata
|
||||||
|
|
||||||
def fb2_footer(self):
|
def fb2_footer(self):
|
||||||
return u'</FictionBook>'
|
return u'</FictionBook>'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user