mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Do not rely on translators getting the trailing spaces right when rendering the series name
This commit is contained in:
parent
ad1c1e7575
commit
8c07e979dd
@ -249,9 +249,10 @@ def render_metadata(mi, table, book_id): # {{{
|
||||
ival = 1.0
|
||||
ival = fmt_sidx(ival, use_roman=interface_data.use_roman_numerals_for_series_number)
|
||||
table.appendChild(E.tr(E.td(name + ':'), E.td()))
|
||||
table.lastChild.lastChild.appendChild(E.span(ival, _(' of '), E.a(
|
||||
href=href_for_search(field, val),
|
||||
title=_('Click to see books with {0}: {1}').format(name, val), val)))
|
||||
s = safe_set_inner_html(E.span(), _('{0} of <a>{1}</a>').format(ival, val))
|
||||
s.lastChild.setAttribute('href', href_for_search(field, val))
|
||||
s.lastChild.setAttribute('title', _('Click to see books with {0}: {1}').format(name, val))
|
||||
table.lastChild.lastChild.appendChild(s)
|
||||
|
||||
def process_field(field, fm):
|
||||
name = fm.name or field
|
||||
|
@ -7,7 +7,7 @@ from gettext import gettext as _
|
||||
|
||||
from dom import build_rule, clear, set_css, svgicon
|
||||
from session import get_interface_data
|
||||
from utils import fmt_sidx, sandboxed_html
|
||||
from utils import fmt_sidx, sandboxed_html, safe_set_inner_html
|
||||
|
||||
DETAILS_LIST_CLASS = 'book-list-details-list'
|
||||
ITEM_CLASS = DETAILS_LIST_CLASS + '-item'
|
||||
@ -85,7 +85,7 @@ def create_item(book_id, metadata, create_image, show_book_details):
|
||||
except Exception:
|
||||
ival = 1.0
|
||||
ival = fmt_sidx(ival, use_roman=interface_data.use_roman_numerals_for_series_number)
|
||||
extra_data.appendChild(E.span(ival, ' ' + _('of') + ' ', E.i(metadata.series)))
|
||||
extra_data.appendChild(safe_set_inner_html(E.span(), _('{0} of <i>{1}</i>').format(ival, metadata.series)))
|
||||
right = E.div(
|
||||
class_='details-list-right',
|
||||
E.div(style='display:flex; justify-content: space-between; overflow: hidden',
|
||||
|
@ -215,7 +215,7 @@ def simple_markup(html):
|
||||
div.textContent = html
|
||||
html = div.innerHTML
|
||||
return html.replace(/\uffff(\/?[a-z1-6]+)\uffff/g, '<$1>')
|
||||
simple_markup.allowed_tags = v"'b|i|br|h1|h2|h3|h4|h5|h6|div|em|strong|span'.split('|')"
|
||||
simple_markup.allowed_tags = v"'a|b|i|br|h1|h2|h3|h4|h5|h6|div|em|strong|span'.split('|')"
|
||||
|
||||
|
||||
def safe_set_inner_html(elem, html):
|
||||
|
Loading…
x
Reference in New Issue
Block a user