diff --git a/src/calibre/ebooks/fb2/fb2ml.py b/src/calibre/ebooks/fb2/fb2ml.py
index 35ebb601fd..75c03aedc2 100644
--- a/src/calibre/ebooks/fb2/fb2ml.py
+++ b/src/calibre/ebooks/fb2/fb2ml.py
@@ -139,6 +139,12 @@ class FB2MLizer(object):
if not metadata['author']:
metadata['author'] = u''
+ 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'] = '%s'%tags
+
metadata['sequence'] = u''
if self.oeb_book.metadata.series:
index = '1'
@@ -156,27 +162,28 @@ class FB2MLizer(object):
metadata['id'] = str(uuid.uuid4())
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)
- return u'' \
- '' \
- '' \
- '%(genre)s' \
- '%(author)s' \
- '%(title)s' \
- '%(cover)s' \
- '%(lang)s' \
- '%(sequence)s' \
- '' \
- '' \
- '%(author)s' \
- '%(appname)s %(version)s' \
- '%(date)s' \
- '%(id)s' \
- '1.0' \
- '' \
- '' % metadata
+ return (u''
+ ''
+ ''
+ '%(genre)s'
+ '%(author)s'
+ '%(title)s'
+ '%(cover)s'
+ '%(lang)s'
+ '%(keywords)s'
+ '%(sequence)s'
+ ''
+ ''
+ '%(author)s'
+ '%(appname)s %(version)s'
+ '%(date)s'
+ '%(id)s'
+ '1.0'
+ ''
+ '') % metadata
def fb2_footer(self):
return u''