mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Insert metadata as jacket page: Make the invisible tags used for searching across books format better, by giving them their own table row.
This commit is contained in:
parent
9b5a4fd9fb
commit
9c93a6e06b
@ -36,6 +36,7 @@
|
|||||||
{tags.alphabetical} -->
|
{tags.alphabetical} -->
|
||||||
<td class="cbj_content">{tags}</td>
|
<td class="cbj_content">{tags}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr data-calibre-jacket-searchable-tags="1" style="color:white; display:none"><td colspan="2">{searchable_tags}</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<div class="cbj_footer">{footer}</div>
|
<div class="cbj_footer">{footer}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -263,10 +263,6 @@ class OutputProfile(Plugin):
|
|||||||
#: Special periodical formatting needed in EPUB
|
#: Special periodical formatting needed in EPUB
|
||||||
epub_periodical_format = None
|
epub_periodical_format = None
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def tags_to_string(cls, tags):
|
|
||||||
from xml.sax.saxutils import escape
|
|
||||||
return escape(', '.join(tags))
|
|
||||||
|
|
||||||
class iPadOutput(OutputProfile):
|
class iPadOutput(OutputProfile):
|
||||||
|
|
||||||
@ -645,11 +641,6 @@ class KindleOutput(OutputProfile):
|
|||||||
|
|
||||||
mobi_ems_per_blockquote = 2.0
|
mobi_ems_per_blockquote = 2.0
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def tags_to_string(cls, tags):
|
|
||||||
return u'%s <br/><span style="color:white">%s</span>' % (', '.join(tags),
|
|
||||||
'ttt '.join(tags)+'ttt ')
|
|
||||||
|
|
||||||
class KindleDXOutput(OutputProfile):
|
class KindleDXOutput(OutputProfile):
|
||||||
|
|
||||||
name = 'Kindle DX'
|
name = 'Kindle DX'
|
||||||
@ -667,11 +658,6 @@ class KindleDXOutput(OutputProfile):
|
|||||||
ratings_char = u'\u2605'
|
ratings_char = u'\u2605'
|
||||||
mobi_ems_per_blockquote = 2.0
|
mobi_ems_per_blockquote = 2.0
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def tags_to_string(cls, tags):
|
|
||||||
return u'%s <br/><span style="color: white">%s</span>' % (', '.join(tags),
|
|
||||||
'ttt '.join(tags)+'ttt ')
|
|
||||||
|
|
||||||
class KindlePaperWhiteOutput(KindleOutput):
|
class KindlePaperWhiteOutput(KindleOutput):
|
||||||
|
|
||||||
name = 'Kindle PaperWhite'
|
name = 'Kindle PaperWhite'
|
||||||
@ -706,12 +692,6 @@ class KindleFireOutput(KindleDXOutput):
|
|||||||
dpi = 169.0
|
dpi = 169.0
|
||||||
comic_screen_size = (570, 1016)
|
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):
|
class IlliadOutput(OutputProfile):
|
||||||
|
|
||||||
name = 'Illiad'
|
name = 'Illiad'
|
||||||
|
@ -310,8 +310,8 @@ class MobiMLizer(object):
|
|||||||
return
|
return
|
||||||
style = stylizer.style(elem)
|
style = stylizer.style(elem)
|
||||||
# <mbp:frame-set/> does not exist lalalala
|
# <mbp:frame-set/> does not exist lalalala
|
||||||
if style['display'] in ('none', 'oeb-page-head', 'oeb-page-foot') \
|
if ((style['display'] in ('none', 'oeb-page-head', 'oeb-page-foot') or style['visibility'] == 'hidden') and
|
||||||
or style['visibility'] == 'hidden':
|
elem.get('data-calibre-jacket-searchable-tags', None) != '1'):
|
||||||
id_ = elem.get('id', None)
|
id_ = elem.get('id', None)
|
||||||
if id_:
|
if id_:
|
||||||
# Keep anchors so people can use display:none
|
# Keep anchors so people can use display:none
|
||||||
|
@ -159,9 +159,10 @@ class Series(unicode):
|
|||||||
class Tags(unicode):
|
class Tags(unicode):
|
||||||
|
|
||||||
def __new__(self, tags, output_profile):
|
def __new__(self, tags, output_profile):
|
||||||
tags = tags or ()
|
tags = [escape(x) for x in tags or ()]
|
||||||
t = unicode.__new__(self, output_profile.tags_to_string(tags))
|
t = unicode.__new__(self, ', '.join(tags))
|
||||||
t.alphabetical = output_profile.tags_to_string(sorted(tags, key=sort_key))
|
t.alphabetical = ', '.join(sorted(tags, key=sort_key))
|
||||||
|
t.tags_list = tags
|
||||||
return t
|
return t
|
||||||
|
|
||||||
def render_jacket(mi, output_profile,
|
def render_jacket(mi, output_profile,
|
||||||
@ -217,7 +218,8 @@ def render_jacket(mi, output_profile,
|
|||||||
rating_label=_('Rating'), rating=rating,
|
rating_label=_('Rating'), rating=rating,
|
||||||
tags_label=_('Tags'), tags=tags,
|
tags_label=_('Tags'), tags=tags,
|
||||||
comments=comments,
|
comments=comments,
|
||||||
footer=''
|
footer='',
|
||||||
|
searchable_tags=' '.join(escape(t)+'ttt' for t in tags.tags_list),
|
||||||
)
|
)
|
||||||
for key in mi.custom_field_keys():
|
for key in mi.custom_field_keys():
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user