This template generates a tooltip showing the note for the publisher, if any. It also shows the count of books by that publisher and a link to search for the publisher in the current library.
Note: Links can be clicked only in the "dialog" version of the tooltip. If you want to be able to click links then I recommend you give that dialog a shortcut in Preferences / Shortcuts / Column tooltips / Show item tooltip in a dialog. You can also add "Column tooltips" to the tool bar, menu bar, or context menu.
The template:
Code:
program:
if ! $publisher then
# Nothing to do here
return 'No publisher'
fi;
# Generate the HTML for the tooltip. First, the name of the publisher.
tt = f_string("<div>Publisher: {$publisher}");
# Generate the search string used to get the publisher count and to do the search
search_for = f_string('publisher:"""={$publisher}"""');
# Add the publisher count to the HTML
tt = f_string("{tt}<br>Count of books published by {$publisher}: {book_count(search_for, 0)}");
# Add the calibre search link to the HTML
tt = f_string('{tt}<br><a href="calibre://search/_?eq={to_hex(search_for)}">' &
'Show books in this calibre library published by {$publisher}</a>');
# Add the note if it exists to the HTML
n = get_note("publisher", $publisher, "");
if n then
tt = f_string('{tt}<p><div>{n}</div></p>')
fi;
# Add the closing </div>
tt = f_string('{tt}</div>');
# Return the generated HTML
tt
The result, shown in a dialog: