Content server: Change formatting of book details to match new de-emphasized titles based formatting in the main calibre program. Fixes #2029723 [[Enhancement] Suggestions to make the Book details panel look nicer](https://bugs.launchpad.net/calibre/+bug/2029723)

This commit is contained in:
Kovid Goyal 2023-10-02 08:38:11 +05:30
parent 4d20e70ea1
commit b284d3661e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 6 deletions

View File

@ -220,7 +220,7 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{
else: else:
parent.appendChild(document.createTextNode(v)) parent.appendChild(document.createTextNode(v))
table.appendChild(E.tr(E.td(name + ':'), E.td())) table.appendChild(E.tr(E.td(name), E.td()))
if is_html and /[<>]/.test(val + ''): if is_html and /[<>]/.test(val + ''):
table.lastChild.lastChild.appendChild(adjusting_sandboxed_html(val + '', iframe_css)) table.lastChild.lastChild.appendChild(adjusting_sandboxed_html(val + '', iframe_css))
else: else:
@ -254,7 +254,7 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{
def process_formats(field, fm, name, val): def process_formats(field, fm, name, val):
if val.length and book_id?: if val.length and book_id?:
table.appendChild(E.tr(E.td(name + ':'), E.td())) table.appendChild(E.tr(E.td(name), E.td()))
td = table.lastChild.lastChild td = table.lastChild.lastChild
for fmt in val: for fmt in val:
fmt = fmt.toUpperCase() fmt = fmt.toUpperCase()
@ -285,7 +285,7 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{
td.appendChild(document.createTextNode(', ')) td.appendChild(document.createTextNode(', '))
td.appendChild(E.a(class_='blue-link', title='{}:{}'.format(k, idval), target='_new', href=url, text)) td.appendChild(E.a(class_='blue-link', title='{}:{}'.format(k, idval), target='_new', href=url, text))
if td.childNodes.length: if td.childNodes.length:
table.appendChild(E.tr(E.td(name + ':'), td)) table.appendChild(E.tr(E.td(name), td))
def process_size(field, fm, name, val): def process_size(field, fm, name, val):
if val: if val:
@ -296,7 +296,7 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{
def process_languages(field, fm, name, val): def process_languages(field, fm, name, val):
if val and val.length: if val and val.length:
table.appendChild(E.tr(E.td(name + ':'), E.td())) table.appendChild(E.tr(E.td(name), E.td()))
td = table.lastChild.lastChild td = table.lastChild.lastChild
for k in val: for k in val:
if mi.lang_names: if mi.lang_names:
@ -326,7 +326,7 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{
except Exception: except Exception:
ival = 1.0 ival = 1.0
ival = fmt_sidx(ival, use_roman=interface_data.use_roman_numerals_for_series_number) ival = fmt_sidx(ival, use_roman=interface_data.use_roman_numerals_for_series_number)
table.appendChild(E.tr(E.td(name + ':'), E.td())) table.appendChild(E.tr(E.td(name), E.td()))
s = safe_set_inner_html(E.span(), _('{0} of <a>{1}</a>').format(ival, val)) s = safe_set_inner_html(E.span(), _('{0} of <a>{1}</a>').format(ival, val))
a = s.getElementsByTagName('a') a = s.getElementsByTagName('a')
if a and a.length: if a and a.length:
@ -439,7 +439,7 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{
def basic_table_rules(sel): def basic_table_rules(sel):
style = '' style = ''
style += build_rule(sel + 'table.metadata td', vertical_align='top') style += build_rule(sel + 'table.metadata td', vertical_align='top')
style += build_rule(sel + 'table.metadata td:first-of-type', font_weight='bold', padding_right='1em', white_space='nowrap') style += build_rule(sel + 'table.metadata td:first-of-type', font_style='italic', color='var(--calibre-color-faded-text)', padding_right='0.5em', white_space='nowrap', text_align='right')
style += build_rule(sel + 'table.metadata td:last-of-type', overflow_wrap='break-word') style += build_rule(sel + 'table.metadata td:last-of-type', overflow_wrap='break-word')
return style return style

View File

@ -25,6 +25,7 @@ DEFAULT_COLORS = {
'window-error-foreground': c('red', '#C40233'), 'window-error-foreground': c('red', '#C40233'),
'window-hover-foreground': c('red', '#C40233'), 'window-hover-foreground': c('red', '#C40233'),
'link-foreground': c('blue', '#6cb4ee'), 'link-foreground': c('blue', '#6cb4ee'),
'faded-text': c('#666', '#7f7f7f'),
# Top bar specific colors # Top bar specific colors
'bar-background': c(DARK, DT_DARK_LIGHTER), 'bar-background': c(DARK, DT_DARK_LIGHTER),