Book details panel: Fix custom columns built from other columns with tag like values not clickable in the book details panel. Fixes #1381323 [Custom Column build from other columns does not show up as clickable](https://bugs.launchpad.net/calibre/+bug/1381323)

Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
Kovid Goyal 2014-10-16 07:49:50 +05:30
commit 0e93afb1e5

View File

@ -92,13 +92,25 @@ def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers=
u'<td class="title">%s</td><td class="rating value" '
'style=\'font-family:"%s"\'>%s</td>'%(
name, rating_font, u'\u2605'*int(val))))
elif metadata['datatype'] == 'composite' and \
metadata['display'].get('contains_html', False):
elif metadata['datatype'] == 'composite':
val = getattr(mi, field)
if val:
val = force_unicode(val)
ans.append((field,
row % (name, comments_to_html(val))))
if metadata['display'].get('contains_html', False):
ans.append((field, row % (name, comments_to_html(val))))
else:
if not metadata['is_multiple']:
val = '<a href="%s" title="%s">%s</a>' % (
search_href(field, val),
_('Click to see books with {0}: {1}').format(metadata['name'], a(val)), p(val))
else:
all_vals = [v.strip()
for v in val.split(metadata['is_multiple']['list_to_ui']) if v.strip()]
links = ['<a href="%s" title="%s">%s</a>' % (
search_href(field, x), _('Click to see books with {0}: {1}').format(
metadata['name'], a(x)), p(x)) for x in all_vals]
val = metadata['is_multiple']['list_to_ui'].join(links)
ans.append((field, row % (name, val)))
elif field == 'path':
if mi.path:
path = force_unicode(mi.path, filesystem_encoding)