09-15-2022, 01:40 PM | #16 | ||
Grand Sorcerer
Posts: 11,966
Karma: 7225107
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
Seriously, real examples are needed, not contrived ones. The solution I posted above might not work for what you are trying to do. It could be that nothing will work. |
||
09-15-2022, 01:45 PM | #17 |
Enthusiast
Posts: 33
Karma: 10
Join Date: Sep 2022
Device: Microsoft Surface Pro 7, Apple iPad
|
Since your response came right after mine that posted just now, I'll link to the relevant threads that should answer your questions:
EDIT: "Put huge images into spoilers" — Noted! |
Advert | |
|
09-15-2022, 01:55 PM | #18 | |
Grand Sorcerer
Posts: 11,966
Karma: 7225107
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
We can stop here, or you can provide real data as described in this post. |
|
09-15-2022, 02:19 PM | #19 | |
Enthusiast
Posts: 33
Karma: 10
Join Date: Sep 2022
Device: Microsoft Surface Pro 7, Apple iPad
|
I don't know how to answer those questions individually, so I'll combine it all into one answer.
The custom column is Filenames (#filenames). I chose the column type Comma-separated text, like tags, shown in the Tag browser because the link of each term/tag (or in this case, filename) allows me to right-click and quickly copy the term name (filename). As I had explained before: Quote:
And that's what I was complaining when I said the terms (filenames) in the custom, auto-generated column (based on the template you provided), despite being proper links, like the terms (filenames) in the original #filenames column, don't allow me to quickly copy the text in a similar manner. That's what I meant when I showed you this: The options are different! I only meant to stop because I felt like I'd be wasting everyone's time. I don't mind answering the questions at all! Those term/tag/filename links don't really have to do anything; ideally it'd be great if they did, because then I could use it elsewhere. Like for Tags too! But the primary objective is to be able to right-click and quickly copy the text (filename). (Filtering/searching filenames is useless, I know. It's the right click option to copy that I am after.) And I do not know how else to explain what I am after. Last edited by 01100001; 09-20-2022 at 09:31 AM. |
|
09-15-2022, 02:36 PM | #20 |
Grand Sorcerer
Posts: 11,966
Karma: 7225107
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
What I understand is that you want a right-click option to copy the text in an unordered list of links. The URLs in the links don't need to do anything, and in fact it isn't clear what they could do.
You can easily achieve what you want by making the URL text be the value you want to copy. You would right-click on the value and choose "Copy link location", which will be the text. Clicking on the link will do nothing because they aren't in fact links. This template does the job. It will work with any source column as long as you set the separator if needed. Hmmm -- there might be special characters that break URL parsing. The template takes care of quotes. Code:
program: j = ''; for i in $tags: j = j & '<li><a href="' & re(i, '"', '"') & '">' & i & '</a></li>' rof; '<ul>' & j & '</ul>' |
Advert | |
|
09-15-2022, 07:19 PM | #21 |
Enthusiast
Posts: 33
Karma: 10
Join Date: Sep 2022
Device: Microsoft Surface Pro 7, Apple iPad
|
I'll see if that's a viable option, thank you.
I have to ask though. Any idea why even though we pretty much replicated the tags and the links (except they are in a list), Calibre gives us the option to copy the link text in case of the default tags but not in the generated custom column? |
09-15-2022, 08:19 PM | #22 | |
null operator (he/him)
Posts: 20,963
Karma: 27620690
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
You can obtain the calibre:// links from the Copy options in book details context menus. If you right click on anything blue (or the background) in the book details panel, you'll get something like this: The option selected put this in my clipboard Code:
calibre://search/_hex_-54657374?eq=7075626c69736865723a223d5072696e6365746f6e20707265737322 BR Last edited by BetterRed; 09-15-2022 at 08:56 PM. |
|
09-16-2022, 01:23 AM | #23 |
Chalut o/
Posts: 420
Karma: 145424
Join Date: Dec 2017
Device: Kobo
|
In the same way that @chaley you suggested a to_hex(), I will suggest a to_url() which would allow to make calibre scheme more human like (and will avoid any bugs).
Code:
def evaluate(self, formatter, kwargs, mi, locals, val): from urllib.parse import quote return quote(val) Bal%20masqu%C3%A9 Code:
<a href="calibre://search/_?q=tags:%22=' & to_url(i) & '%22"> Last edited by un_pogaz; 09-16-2022 at 01:46 AM. |
09-17-2022, 02:10 AM | #24 |
Enthusiast
Posts: 33
Karma: 10
Join Date: Sep 2022
Device: Microsoft Surface Pro 7, Apple iPad
|
I wanted a bullet/unordered list so I could easily differentiate, at a glance, the different terms of a field (tags, or filenames (custom column))—which look like one long line of links by default.
In the end I decided that going the least intrusive way (albeit not best aesthetically or preferred) is better than hacking code in this manner unless absolutely necessary. Just a bit of CSS code helps me with that (added under Preferences > Look & feel > Book details > Text styling): Code:
/* CUSTOM */ #_filenames { color: red; } #_filenames .title { color: black; } Simple, yet much better (than default). I know this isn't what I asked, and you all were very kind and helpful with my actual question. What learnt here, I am sure will be helpful elsewhere (and to someone else). Thank you all! Reference: https://doc.qt.io/qt-5/richtext-html-subset.html Last edited by 01100001; 09-17-2022 at 07:59 AM. Reason: Added reference link |
09-17-2022, 04:38 AM | #25 | |
null operator (he/him)
Posts: 20,963
Karma: 27620690
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
Spotting the errors in a list like the following is 'hard' (an extreme example): An 'error' I see a lot is because of missing qualification suffixes that get interpreted as family names. In that list there's a Prof FMedSci. BR |
|
09-17-2022, 07:43 AM | #26 |
Enthusiast
Posts: 33
Karma: 10
Join Date: Sep 2022
Device: Microsoft Surface Pro 7, Apple iPad
|
Absolutely agree.
In similar APIs (CMSs), to my knowledge, usually there's a way to get a field term (e.g., different taxonomy/tag terms) as text-only as well as linked-text (i.e. both text and link). I was assuming the same when I asked this question. Indeed a bummer that there's no simpler/built-in way. I want to learn Python and do something about it (a plugin perhaps). As of now I have no programming knowledge, except for some googlefu. (PS: Not blaming devs or anything.) |
09-18-2022, 05:34 AM | #27 | ||
Grand Sorcerer
Posts: 11,966
Karma: 7225107
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
Most of what you both want (I think) is in calibre source now. I didn't bother with bullets and their hanging indents. |
||
09-18-2022, 05:39 PM | #28 | ||
null operator (he/him)
Posts: 20,963
Karma: 27620690
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
Quote:
It's sort of surprising that it hasn't been requested before. BR |
||
09-19-2022, 09:16 AM | #29 |
Enthusiast
Posts: 33
Karma: 10
Join Date: Sep 2022
Device: Microsoft Surface Pro 7, Apple iPad
|
|
09-19-2022, 09:22 AM | #30 | |
null operator (he/him)
Posts: 20,963
Karma: 27620690
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
Enhancement: in book details, allow displaying is_multiple categories on separate lines BR |
|
Tags |
calibe, calibre 6.4, custom columns, html, template language |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Merging custom column into Tags | MimiRose113 | Library Management | 1 | 03-31-2021 02:59 AM |
Custom column from tags | jelzin | Library Management | 4 | 03-15-2021 02:30 PM |
How can I boolean OR several tags into one custom column? | bmix | Library Management | 3 | 01-09-2015 03:57 AM |
Download tags to a custom column | atjnjk | Library Management | 8 | 01-18-2012 08:02 AM |
Help with template for custom column from tags | africalass | Library Management | 2 | 07-16-2011 11:47 AM |