From b84daddb742ad16ae640237c3a8fde97d0c901ab Mon Sep 17 00:00:00 2001 From: un-pogaz <46523284+un-pogaz@users.noreply.github.com> Date: Sat, 8 Feb 2025 10:35:14 +0100 Subject: [PATCH] never reached code --- src/calibre/ebooks/metadata/book/render.py | 42 ++++++++++------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/src/calibre/ebooks/metadata/book/render.py b/src/calibre/ebooks/metadata/book/render.py index 33eef885bc..9f8a2b4147 100644 --- a/src/calibre/ebooks/metadata/book/render.py +++ b/src/calibre/ebooks/metadata/book/render.py @@ -420,37 +420,31 @@ def mi_to_html( if not metadata.get('display', {}).get('is_names', False): all_vals = sorted(all_vals, key=sort_key) links = [] - if show_links: - for x in all_vals: - if metadata['is_custom']: - u, v = cc_search_action_with_data(field, x, book_id, metadata, mi, field) - v = f'{p(x)}' - else: - v = '{}'.format( - search_action_with_data(st, x, book_id, field), - _('Click to see books with {0}: {1}').format( - metadata['name'] or field, a(x)), p(x)) - v += add_other_links(field, x) - links.append(v) - else: - links = all_vals + for x in all_vals: + if metadata['is_custom']: + u, v = cc_search_action_with_data(field, x, book_id, metadata, mi, field) + v = f'{p(x)}' + else: + v = '{}'.format( + search_action_with_data(st, x, book_id, field), + _('Click to see books with {0}: {1}').format( + metadata['name'] or field, a(x)), p(x)) + v += add_other_links(field, x) + links.append(v) val = value_list(metadata['is_multiple']['list_to_ui'], links) else: try: st = metadata['search_terms'][0] except Exception: st = field - if show_links: - if metadata['is_custom']: - u, v = cc_search_action_with_data(st, unescaped_val, book_id, metadata, mi, field) - v = f'{p(unescaped_val)}' - else: - v = '{}'.format( - search_action_with_data(st, unescaped_val, book_id, field), - _('Click to see books with {0}: {1}').format( - metadata['name'] or field, a(unescaped_val)), p(unescaped_val)) + if metadata['is_custom']: + u, v = cc_search_action_with_data(st, unescaped_val, book_id, metadata, mi, field) + v = f'{p(unescaped_val)}' else: - v = val + v = '{}'.format( + search_action_with_data(st, unescaped_val, book_id, field), + _('Click to see books with {0}: {1}').format( + metadata['name'] or field, a(unescaped_val)), p(unescaped_val)) val = v + add_other_links(field, val) elif metadata['datatype'] == 'enumeration': u, v = cc_search_action_with_data(field, unescaped_val, book_id, metadata, mi, field)