Quote:
Originally Posted by chaley
Another way to do this is to generate the links directly in a composite column. An example template is attached.
This template depends on there being a column 'Text behaves like tags' named #comp2 that contains the book ids of interest. (I reuse existing test column names.) The template in column #comp3 (composite, contains html) generates a comma-separated list of clickable links from the book ids in #comp2. See the screen capture. You would normally hide #comp3 in the book list. You would of course change the lookup names to the columns you made.
Note also the column #comp2. This contains the template {id} so I can easily see them. Having this is up to you. It certainly isn't necessary.
Once set up, this is easier than pasting links into comments. The list of ids in the column is easily editable, with the resulting links automatically generated.
Here is the template. It requires calibre 6.5.
Code:
program:
j = '';
for id in $#mytextmult:
if j then j = j & ', ' fi;
j = j & '<a href="' & 'calibre://show-book/_hex_-' &
to_hex(current_library_name()) & '/' & id & '">' & id & '</a>'
rof
which produces this:
Attachment 196675
Enhancement: the template could verify that the id actually exists, which can happen because of an input error or deleting a book. If the id doesn't exist then a message is displayed. Something like this:
Code:
program:
j = '';
for id in $#mytextmult:
if j then j = j & ', ' fi;
id_exists = book_count('id:' & id, 0);
if id_exists != 1 then
j = j & 'No such id ' & id
else
j = j & '<a href="' & 'calibre://show-book/_hex_-' &
to_hex(current_library_name()) & '/' & id & '">' & id & '</a>'
fi
rof
which produces this:
Attachment 196676
|
ahhh, thank you so much!
I'm going to test that ASAP.