diff --git a/resources/jacket/template.xhtml b/resources/jacket/template.xhtml
index cb38b5b2a7..07f7abeb16 100644
--- a/resources/jacket/template.xhtml
+++ b/resources/jacket/template.xhtml
@@ -36,6 +36,7 @@
{tags.alphabetical} -->
{tags} |
+ {searchable_tags} |
diff --git a/src/calibre/customize/profiles.py b/src/calibre/customize/profiles.py
index f917c80717..bf0b7ef8e3 100644
--- a/src/calibre/customize/profiles.py
+++ b/src/calibre/customize/profiles.py
@@ -263,10 +263,6 @@ class OutputProfile(Plugin):
#: Special periodical formatting needed in EPUB
epub_periodical_format = None
- @classmethod
- def tags_to_string(cls, tags):
- from xml.sax.saxutils import escape
- return escape(', '.join(tags))
class iPadOutput(OutputProfile):
@@ -645,11 +641,6 @@ class KindleOutput(OutputProfile):
mobi_ems_per_blockquote = 2.0
- @classmethod
- def tags_to_string(cls, tags):
- return u'%s
%s' % (', '.join(tags),
- 'ttt '.join(tags)+'ttt ')
-
class KindleDXOutput(OutputProfile):
name = 'Kindle DX'
@@ -667,11 +658,6 @@ class KindleDXOutput(OutputProfile):
ratings_char = u'\u2605'
mobi_ems_per_blockquote = 2.0
- @classmethod
- def tags_to_string(cls, tags):
- return u'%s
%s' % (', '.join(tags),
- 'ttt '.join(tags)+'ttt ')
-
class KindlePaperWhiteOutput(KindleOutput):
name = 'Kindle PaperWhite'
@@ -706,12 +692,6 @@ class KindleFireOutput(KindleDXOutput):
dpi = 169.0
comic_screen_size = (570, 1016)
- @classmethod
- def tags_to_string(cls, tags):
- # The idiotic fire doesn't obey the color:white directive
- from xml.sax.saxutils import escape
- return escape(', '.join(tags))
-
class IlliadOutput(OutputProfile):
name = 'Illiad'
diff --git a/src/calibre/ebooks/mobi/mobiml.py b/src/calibre/ebooks/mobi/mobiml.py
index 966a3c2ee8..1afdd10ad1 100644
--- a/src/calibre/ebooks/mobi/mobiml.py
+++ b/src/calibre/ebooks/mobi/mobiml.py
@@ -310,8 +310,8 @@ class MobiMLizer(object):
return
style = stylizer.style(elem)
# does not exist lalalala
- if style['display'] in ('none', 'oeb-page-head', 'oeb-page-foot') \
- or style['visibility'] == 'hidden':
+ if ((style['display'] in ('none', 'oeb-page-head', 'oeb-page-foot') or style['visibility'] == 'hidden') and
+ elem.get('data-calibre-jacket-searchable-tags', None) != '1'):
id_ = elem.get('id', None)
if id_:
# Keep anchors so people can use display:none
diff --git a/src/calibre/ebooks/oeb/transforms/jacket.py b/src/calibre/ebooks/oeb/transforms/jacket.py
index 287b4f28ae..5537314b91 100644
--- a/src/calibre/ebooks/oeb/transforms/jacket.py
+++ b/src/calibre/ebooks/oeb/transforms/jacket.py
@@ -159,9 +159,10 @@ class Series(unicode):
class Tags(unicode):
def __new__(self, tags, output_profile):
- tags = tags or ()
- t = unicode.__new__(self, output_profile.tags_to_string(tags))
- t.alphabetical = output_profile.tags_to_string(sorted(tags, key=sort_key))
+ tags = [escape(x) for x in tags or ()]
+ t = unicode.__new__(self, ', '.join(tags))
+ t.alphabetical = ', '.join(sorted(tags, key=sort_key))
+ t.tags_list = tags
return t
def render_jacket(mi, output_profile,
@@ -217,7 +218,8 @@ def render_jacket(mi, output_profile,
rating_label=_('Rating'), rating=rating,
tags_label=_('Tags'), tags=tags,
comments=comments,
- footer=''
+ footer='',
+ searchable_tags=' '.join(escape(t)+'ttt' for t in tags.tags_list),
)
for key in mi.custom_field_keys():
try: