Limit max length of book info entries

This commit is contained in:
Kovid Goyal 2022-06-09 22:05:45 +05:30
parent 68e90f1ddc
commit 772febd578
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -501,11 +501,20 @@ class ResultDetails(QWidget):
self.do_layout() self.do_layout()
def render_book_info(self, results): def render_book_info(self, results):
t = results.title
if len(t) > 72:
t = t[:71] + ''
text = f'<p><b>{results.title}</b><br>' text = f'<p><b>{results.title}</b><br>'
text += f'{authors_to_string(results.authors)}</p>' au = results.authors
if len(au) > 3:
au = list(au[:3]) + ['']
text += f'{authors_to_string(au)}</p>'
if results.series: if results.series:
sidx = fmt_sidx(results.series_index or 0, use_roman=config['use_roman_numerals_for_series_number']) sidx = fmt_sidx(results.series_index or 0, use_roman=config['use_roman_numerals_for_series_number'])
text += '<p>' + _('{series_index} of {series}').format(series_index=sidx, series=results.series) + '</p>' series = results.series
if len(series) > 60:
series = series[:59] + ''
text += '<p>' + _('{series_index} of {series}').format(series_index=sidx, series=series) + '</p>'
text += '<p><a href="calibre://jump" title="{1}"><img valign="bottom" src="calibre-icon:///lt.png" width=16 height=16>\xa0{0}</a>\xa0\xa0\xa0 '.format( text += '<p><a href="calibre://jump" title="{1}"><img valign="bottom" src="calibre-icon:///lt.png" width=16 height=16>\xa0{0}</a>\xa0\xa0\xa0 '.format(
_('Select'), '<p>' + _('Scroll to this book in the calibre library book list and select it.')) _('Select'), '<p>' + _('Scroll to this book in the calibre library book list and select it.'))
text += '<a href="calibre://mark" title="{1}"><img valig="bottom" src="calibre-icon:///marked.png" width=16 height=16>\xa0{0}</a></p>'.format( text += '<a href="calibre://mark" title="{1}"><img valig="bottom" src="calibre-icon:///marked.png" width=16 height=16>\xa0{0}</a></p>'.format(