Links to open search results

This commit is contained in:
Kovid Goyal 2022-06-15 09:19:09 +05:30
parent 7772400f04
commit dc97cffbec
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -578,7 +578,13 @@ class ResultDetails(QWidget):
continue continue
text = result['text'] text = result['text']
text = markup_text(prepare_string_for_xml(text)) text = markup_text(prepare_string_for_xml(text))
html.append(f'<hr><p>{text}</p>') html.append('<hr>')
for fmt in formats:
fmt = fmt.upper()
tt = _('Open the book, in the {fmt} format.\nWhen using the calibre viewer, it will attempt to scroll\nto this search result automatically.'
).format(fmt=fmt)
html.append(f'<a title="{tt}" href="book:///{self.current_book_id}/{fmt}">{fmt}</a>\xa0 ')
html.append(f'<p>{text}</p>')
self.results.setHtml('\n'.join(html)) self.results.setHtml('\n'.join(html))