diff --git a/src/calibre/gui2/fts/cards.py b/src/calibre/gui2/fts/cards.py index f7fa2234b1..dae1935b15 100644 --- a/src/calibre/gui2/fts/cards.py +++ b/src/calibre/gui2/fts/cards.py @@ -169,8 +169,8 @@ class CardData: series = '' if s := self.results.series: sidx = fmt_sidx(self.results.series_index or 0, use_roman=config['use_roman_numerals_for_series_number']) - series = _('{series_index} of {series}').format(series_index=sidx, series=s) - series = f'{prepare_string_for_xml(series)}
' + series = _('{series_index} of {series}').format(series_index=sidx, series=prepare_string_for_xml(s)) + series = f' ({series})' results = [] ftt = _('Open the book, in the {fmt} format.\nWhen using the calibre E-book viewer, it will attempt to scroll\n' 'to this search result automatically.') @@ -187,11 +187,12 @@ class CardData: ftxt = '\xa0'.join(fmts) results.append(f'
{ftxt} {text}') + pal = QApplication.instance().palette() + accent = pal.color(QPalette.ColorRole.Accent).name() html = f'''
{prepare_string_for_xml(self.results.title)}
-{prepare_string_for_xml(authors_to_string(self.results.authors))}
-{series} +{prepare_string_for_xml(authors_to_string(self.results.authors))}{series}
{button_line(self.results.book_id, self.results.book_in_db)}
{'
'.join(results)} diff --git a/src/calibre/gui2/fts/utils.py b/src/calibre/gui2/fts/utils.py index c988c07f25..941bf16fe1 100644 --- a/src/calibre/gui2/fts/utils.py +++ b/src/calibre/gui2/fts/utils.py @@ -18,13 +18,13 @@ def get_db(): return get_gui().current_db.new_api -def markup_text(text: str) -> str: +def markup_text(text: str, open_tag: str = '', close_tag: str = '') -> str: closing = False def sub(m): nonlocal closing closing = not closing - return '' if closing else '' + return open_tag if closing else close_tag return re.sub(r'\x1d', sub, prepare_string_for_xml(text))