Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 09-15-2022, 01:40 PM   #16
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by 01100001 View Post
EDIT: To answer your question

This isn't about tags. It's just an example. I'll be using this for a tags-like custom column called Filenames. Since I want it to behave like tags (for my specific usecase), let's just assume we are dealing with tags.
This easily could be a bad assumption.
Quote:
And why tags-like column and not something else? Because I want the links-like terms that tags have. Just right-click and you can quickly copy the link text (in my case filename). For normal text, I'd have to manually select the text, make sure no line breaks/endings are selections and then copy the text.

Just trying to optimize things for my workflow here.
You leave out the most important information:
  • What exactly does clicking on one of these filenames search for? A value in a column? A book in calibre? Something else?
  • Does the calibre URL system support that search?
  • How does a template find the information to put in the URL?
  • How does it find the information to display?

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.
chaley is offline   Reply With Quote
Old 09-15-2022, 01:45 PM   #17
01100001
Enthusiast
01100001 began at the beginning.
 
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!
01100001 is offline   Reply With Quote
Advert
Old 09-15-2022, 01:55 PM   #18
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by 01100001 View Post
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!
Those posts do not provide the necessary information. One says they items behave like tags which means they search for column values in the current library, but that is almost certainly not what you want. The second doesn't clarify it. I still don't know what clicking on one of these filename links is supposed to do.

We can stop here, or you can provide real data as described in this post.
chaley is offline   Reply With Quote
Old 09-15-2022, 02:19 PM   #19
01100001
Enthusiast
01100001 began at the beginning.
 
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 why tags-like column and not something else? Because I want the links-like terms that tags have. Just right-click and you can quickly copy the link text (in my case filename). For normal text, I'd have to manually select the text, make sure no line breaks/endings are selections and then copy the text.
That's what I was trying to show in this image:

Click image for larger version

Name:	Default tag-like link's right click options.png
Views:	58
Size:	120.8 KB
ID:	196651

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:

Click image for larger version

Name:	Custom link right-click options.png
Views:	57
Size:	52.6 KB
ID:	196652

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.
01100001 is offline   Reply With Quote
Old 09-15-2022, 02:36 PM   #20
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
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, '"', '&quot;') & '">' & i & '</a></li>'
	rof;
	'<ul>' & j & '</ul>'
chaley is offline   Reply With Quote
Advert
Old 09-15-2022, 07:19 PM   #21
01100001
Enthusiast
01100001 began at the beginning.
 
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?
01100001 is offline   Reply With Quote
Old 09-15-2022, 08:19 PM   #22
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,590
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by 01100001 View Post
@un_pogaz Yep, I am aware of that, but I am looking to see if there's a built-in, less error-prone way to go about it. Esp. because I'd have to code the URLs in which the search terms must be encoded right.
FTR: I use the calibre:// URL scheme extensively - the notion that I would create and/or could accurately type hex versions of the required strings is truly risible.

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:

Click image for larger version

Name:	Screenshot 2022-09-16 095836.jpg
Views:	362
Size:	50.9 KB
ID:	196563

The option selected put this in my clipboard

Code:
calibre://search/_hex_-54657374?eq=7075626c69736865723a223d5072696e6365746f6e20707265737322
To do with as I wish - like paste it into a onenote note, why would I want to that? Dunno, but its good to know that I can - by the way it works, viz:

Click image for larger version

Name:	Screenshot 2022-09-16 101650.jpg
Views:	54
Size:	107.1 KB
ID:	196565

BR

Last edited by BetterRed; 09-15-2022 at 08:56 PM.
BetterRed is online now   Reply With Quote
Old 09-16-2022, 01:23 AM   #23
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 410
Karma: 145324
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 masqué

Bal%20masqu%C3%A9

Code:
<a href="calibre://search/_?q=tags:%22=' & to_url(i) & '%22">
<a href="calibre://search/_?q=tags:%22=Bal%20masqu%C3%A9%22">

Last edited by un_pogaz; 09-16-2022 at 01:46 AM.
un_pogaz is offline   Reply With Quote
Old 09-17-2022, 02:10 AM   #24
01100001
Enthusiast
01100001 began at the beginning.
 
Posts: 33
Karma: 10
Join Date: Sep 2022
Device: Microsoft Surface Pro 7, Apple iPad
Thumbs up

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;
}
So now, my Filenames (#filenames) field in Book details pane, looks like this:

Click image for larger version

Name:	Screenshot 2022-09-17 112955.png
Views:	57
Size:	53.0 KB
ID:	196587

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
01100001 is offline   Reply With Quote
Old 09-17-2022, 04:38 AM   #25
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,590
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by 01100001 View Post
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.
Bugger - I've wanted to have Tags, Authors etc display as a vertical one-item-per-line list in Book Details since forever. I was hoping you were on track to teasing out a simple solution.

Spotting the errors in a list like the following is 'hard' (an extreme example):

Click image for larger version

Name:	Screenshot 2022-09-17 182332.jpg
Views:	425
Size:	105.8 KB
ID:	196588

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
BetterRed is online now   Reply With Quote
Old 09-17-2022, 07:43 AM   #26
01100001
Enthusiast
01100001 began at the beginning.
 
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.)
01100001 is offline   Reply With Quote
Old 09-18-2022, 05:34 AM   #27
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by 01100001 View Post
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.
Problem: calibre was never conceived of as a CMS in the sense you are describing. To do what you describe some kind of UI template scheme is necessary, and large parts of calibre aren't amenable to that because of interesting interlocking data semantics. It could be possible (I think) for "reports" like book details, but making the templates recreate the current look would be interesting. In any event, I am not interested in doing that work.
Quote:
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.
A plugin can't solve this problem because rendering for book details is built into calibre. The first thing required would be to turn the current renderer into a plugin, and probably the field selector code as well. I don't see that happening anytime soon, but who knows?
Quote:
Originally Posted by BetterRed View Post
Bugger - I've wanted to have Tags, Authors etc display as a vertical one-item-per-line list in Book Details since forever. I was hoping you were on track to teasing out a simple solution.
Most of what you both want (I think) is in calibre source now. I didn't bother with bullets and their hanging indents.
Attached Thumbnails
Click image for larger version

Name:	Clipboard01.jpg
Views:	58
Size:	161.9 KB
ID:	196596   Click image for larger version

Name:	Clipboard06.jpg
Views:	59
Size:	237.1 KB
ID:	196597  
chaley is offline   Reply With Quote
Old 09-18-2022, 05:39 PM   #28
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,590
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by BetterRed View Post
Bugger - I've wanted to have Tags, Authors etc display as a vertical one-item-per-line list in Book Details since forever. I was hoping you were on track to teasing out a simple solution.
Quote:
Originally Posted by chaley View Post
Most of what you both want (I think) is in calibre source now. I didn't bother with bullets and their hanging indents.
a bunch

It's sort of surprising that it hasn't been requested before.

BR
BetterRed is online now   Reply With Quote
Old 09-19-2022, 09:16 AM   #29
01100001
Enthusiast
01100001 began at the beginning.
 
Posts: 33
Karma: 10
Join Date: Sep 2022
Device: Microsoft Surface Pro 7, Apple iPad
Thumbs up

Quote:
Originally Posted by chaley View Post
[...] Re: Those referenced screenshots...
Are you saying those are going to be in the next release? (I have v.6.5.0 and I don't see them.) If so, that's awesome, thank you!
01100001 is offline   Reply With Quote
Old 09-19-2022, 09:22 AM   #30
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,590
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by 01100001 View Post
Are you saying those are going to be in the next release? (I have v.6.5.0 and I don't see them.) If so, that's awesome, thank you!
It'll be in 6.6

Enhancement: in book details, allow displaying is_multiple categories on separate lines

BR
BetterRed is online now   Reply With Quote
Reply

Tags
calibe, calibre 6.4, custom columns, html, template language


Forum Jump

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


All times are GMT -4. The time now is 06:32 AM.


MobileRead.com is a privately owned, operated and funded community.