01-20-2021, 05:52 AM | #1 |
Member
Posts: 20
Karma: 10
Join Date: Mar 2020
Device: Moon+ Reader
|
Template for jacket, include identifiers
I am editing the template for the jacket that is stored at:
/Users/useract/Library/Preferences/calibre/resources/jacket/template.xhtml I want to display the identifiers for the book. I attempted to use the template code: {identifiers:select(isbn)} But that causes the jacket creation to fail. How can I display what is in the identifiers metadata on the jacket? I would prefer to list all just as it is in the Edit metadata window, but will settle for only displaying the isbn. What should I use and where is there a list of what metadata can be used in the jacket template? |
01-20-2021, 08:25 AM | #2 |
Member
Posts: 20
Karma: 10
Join Date: Mar 2020
Device: Moon+ Reader
|
I solved this by simply creating custom fields based on other fields for all the various identifiers I want to include and place them on the jacket as follows
<tr> <td class="cbj_label">ISBN:</td> <td class="cbj_content">{_isbn_enter} {_isbn_p_enter}</td> Now, can someone tell me where is the source for "footer" where in the metadata is that entered? I see it on the template {footer} In addition, in the css template there are comments as follows: "If a book does not have Series information, a date of publication, a rating or tags the corresponding row is automatically removed from the generated book jacket." Is there some way to also have this behavior for other fields. That is, if that metadata is not present, do not display the label as well? |
Advert | |
|
01-20-2021, 09:07 AM | #3 |
creator of calibre
Posts: 43,853
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
footer is there for legacy compat it doesnt do anything. And no i'm afraid there is no way to conditionally include sections, the template language used in the jacket is not that powerful. However, this is easy enough to add: https://github.com/kovidgoyal/calibr...4418b806b51201
|
01-20-2021, 09:36 AM | #4 |
creator of calibre
Posts: 43,853
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
And since I was there, added support for identifiers as well: https://github.com/kovidgoyal/calibr...e0a6c84dc9b8e4
|
01-20-2021, 08:20 PM | #5 |
Member
Posts: 20
Karma: 10
Join Date: Mar 2020
Device: Moon+ Reader
|
That is more than I had expected. Thank you very much. It makes a lot more sense now
|
Advert | |
|
01-22-2021, 08:33 AM | #6 |
Guru
Posts: 927
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
Hi, Kovid.
When I try to use polish to include a Metadata Jacket, I get this error: Spoiler:
It doesn't matter if the book has any series info. It always throw the same error. |
01-22-2021, 09:34 AM | #7 |
creator of calibre
Posts: 43,853
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
01-22-2021, 10:28 AM | #8 | |
Guru
Posts: 927
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
Quote:
|
|
01-22-2021, 05:22 PM | #9 | |
Grand Sorcerer
Posts: 6,233
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Quote:
|
|
01-22-2021, 10:14 PM | #10 |
creator of calibre
Posts: 43,853
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You have your quotes in the wrong place, it should be
<div style="display:{display._sse}"> |
01-23-2021, 03:20 AM | #11 |
Grand Sorcerer
Posts: 6,233
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Thank you, yes, I wasn't setting the keys and that's the problem.
|
01-23-2021, 03:35 AM | #12 |
Grand Sorcerer
Posts: 6,233
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Ah, and thank you again, as I can remove two additional columns that I had set only for hiding a couple of fields in the jackets.
|
01-28-2021, 06:11 AM | #13 |
Member
Posts: 20
Karma: 10
Join Date: Mar 2020
Device: Moon+ Reader
|
According to the instructions in the comments:
"If you want to insert the identifiers you can do so either as a comma separated list of links, just like they are displayed in the Book details panel,..." How is that formatted, I do not see the coding details. I only see the following: {display.identifiers} {identifiers.links} {identifiers.display.isbn} display.identifiers returns the text "Initial" if any identifier and "none" otherwise. And the links only will display the isbn as a link. But nothing about how to return all identifiers... as stated? Side comment, "identifiers.display.isbn" ... seems like using "display" here is confusing, as "display" used in other cases for use with the display CSS tag. If I were to specify I would expect something like {display.identifiers} - as is {identifiers.isbn.link} - display the 1 isbn (if there is one) as a link {identifiers.isbn} - display the 1 isbn (if there is one) as text {identifiers} or perhaps {identifiers.text} display all identifiers just as it shows in the edit metadata GUI {identifiers.select('text-string')} - display the 1 value (if it exists) for the identifier with the name "text-string" If all cases, if there is none available, return empty string [Note there can only be one isbn since that field is setup not allow more than one] Example, the following is entered in the Ids GUI: isbn:9781101188057, isbn-p:9780399156434, asin:B002DW936A {display.identifiers} will return "Initial" {identifiers.isbn.link} will return "<a href="https://www.worldcat.org/isbn/9781416587101" title="isbn:9781101188057">9781101188057</a>" {identifiers.isbn} will return "9781101188057" {identifiers.text} will return "isbn:9781101188057, isbn-p:9780399156434, asin:B002DW936A" {identifiers.select('isbn-p')} will return "9780399156434" Last edited by nindotza; 01-28-2021 at 06:48 AM. |
01-28-2021, 06:44 AM | #14 |
creator of calibre
Posts: 43,853
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
ISBN: {identifiers.isbn}, Whatever: {identifiers.whatever}, ...
|
01-28-2021, 07:52 PM | #15 |
Member
Posts: 20
Karma: 10
Join Date: Mar 2020
Device: Moon+ Reader
|
That works, for how to display individual values from the identifiers. The comments in the /Applications/calibre.app/Contents/Resources/resources/jacket/template.xhtml file are still unclear as to how to
"...insert the identifiers you can do so either as a comma separated list of links, just like they are displayed in the Book details panel,..." (in other words display all as a line of text) [Note I tested {identifiers.isbn-p} and it does return the expected value.] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Identifiers | Rellwood | Calibre | 2 | 10-31-2019 10:51 PM |
Need help changing template for Metadata Book Jacket | jecilop | Calibre | 14 | 10-14-2018 06:27 AM |
Using built-in template functions in a custom template function | ilovejedd | Library Management | 4 | 01-28-2018 12:20 PM |
Help! Big PB customizing jacket template | alphane | Library Management | 2 | 04-30-2014 12:28 PM |
Polish Books does not include identifiers | Katsunami | Calibre | 3 | 10-11-2013 03:41 PM |