From 8304f14c7d17e10790ff3c8bdc399e81c8d9dc9c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 17 Feb 2016 11:15:28 +0530 Subject: [PATCH] ... --- src/pyj/book_list/book_details.pyj | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/pyj/book_list/book_details.pyj b/src/pyj/book_list/book_details.pyj index 2ffbbe7fdb..e3060a1757 100644 --- a/src/pyj/book_list/book_details.pyj +++ b/src/pyj/book_list/book_details.pyj @@ -139,20 +139,21 @@ def render_metadata(mi, interface_data, table, field_list=None): add_row(name, val) def process_identifiers(field, fm, name, val): - if val and val.length: - table.appendChild(E.tr(E.td(name + ':'), E.td())) - url_map = {k:v'[text, url]' for text, k, val, url in mi.urls_from_identifiers or v'[]'} - td = table.lastChild.lastChild + if val: keys = Object.keys(val) - for k in keys: - idval = val[k] - x = url_map[k] - if isinstance(x, list) and x.length == 2: - td.appendChild(E.a(title=str.format('{}:{}', k, idval), target='_new', href=x[1], x[0])) - else: - td.appendChild(E.span(k, ':', idval)) - if k is not keys[-1]: - td.appendChild(document.createTextNode(', ')) + if keys.length: + table.appendChild(E.tr(E.td(name + ':'), E.td())) + url_map = {k:v'[text, url]' for text, k, val, url in mi.urls_from_identifiers or v'[]'} + td = table.lastChild.lastChild + for k in keys: + idval = val[k] + x = url_map[k] + if isinstance(x, list) and x.length == 2: + td.appendChild(E.a(title=str.format('{}:{}', k, idval), target='_new', href=x[1], x[0])) + else: + td.appendChild(E.span(k, ':', idval)) + if k is not keys[-1]: + td.appendChild(document.createTextNode(', ')) def process_languages(field, fm, name, val): if val and val.length: @@ -325,7 +326,7 @@ class BookDetailsPanel: if not metadata.formats or not metadata.formats.length: row.style.display = 'none' container.appendChild(row) - md = E.div(style='max-width:500px; margin-bottom: 1ex') + md = E.div(style='max-width:500px; margin-bottom: 2ex') table = E.table(class_='metadata') container.appendChild(md) md.appendChild(table)