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 01-20-2021, 05:52 AM   #1
nindotza
Member
nindotza began at the beginning.
 
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?
nindotza is offline   Reply With Quote
Old 01-20-2021, 08:25 AM   #2
nindotza
Member
nindotza began at the beginning.
 
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?
nindotza is offline   Reply With Quote
Advert
Old 01-20-2021, 09:07 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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
kovidgoyal is offline   Reply With Quote
Old 01-20-2021, 09:36 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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
kovidgoyal is offline   Reply With Quote
Old 01-20-2021, 08:20 PM   #5
nindotza
Member
nindotza began at the beginning.
 
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
nindotza is offline   Reply With Quote
Advert
Old 01-22-2021, 08:33 AM   #6
thiago.eec
Guru
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
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:

calibre, version 5.10.0 (win32, embedded-python: True)
Erro ao converter: Falha: Polir A organização

Polir A organização
Traceback (most recent call last):
File "runpy.py", line 194, in _run_module_as_main
File "runpy.py", line 87, in _run_code
File "site.py", line 82, in <module>
File "site.py", line 77, in main
File "site.py", line 49, in run_entry_point
File "calibre\utils\ipc\worker.py", line 216, in main
File "calibre\ebooks\oeb\polish\main.py", line 297, in gui_polish
File "calibre\ebooks\oeb\polish\main.py", line 275, in polish
File "calibre\ebooks\oeb\polish\main.py", line 196, in polish_one
File "calibre\ebooks\oeb\polish\jacket.py", line 96, in add_or_replace_jacket
File "calibre\ebooks\oeb\polish\jacket.py", line 61, in replace_jacket
File "calibre\ebooks\oeb\polish\jacket.py", line 22, in render_jacket
File "calibre\ebooks\oeb\transforms\jacket.py", line 388, in render_jacket
File "calibre\ebooks\oeb\transforms\jacket.py", line 377, in generate_html
AttributeError: 'dict' object has no attribute 'series'


It doesn't matter if the book has any series info. It always throw the same error.
thiago.eec is offline   Reply With Quote
Old 01-22-2021, 09:34 AM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,853
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://github.com/kovidgoyal/calibr...eb64af95f7ad02
kovidgoyal is offline   Reply With Quote
Old 01-22-2021, 10:28 AM   #8
thiago.eec
Guru
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 927
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
Quote:
Originally Posted by kovidgoyal View Post
Thanks!
thiago.eec is offline   Reply With Quote
Old 01-22-2021, 05:22 PM   #9
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
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:
Originally Posted by kovidgoyal View Post
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
Kovid, thank you for this commit, but I have a question. Imagine I've got a second series (#sse). If I don't want the series to appear in the jacket if it is empty, I should include <"div style="display:display._sse>. Am I right? Because, with this tag, the label is still showing in the viewer.
Terisa de morgan is offline   Reply With Quote
Old 01-22-2021, 10:14 PM   #10
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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}">
kovidgoyal is offline   Reply With Quote
Old 01-23-2021, 03:20 AM   #11
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
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.
Terisa de morgan is offline   Reply With Quote
Old 01-23-2021, 03:35 AM   #12
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
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.
Terisa de morgan is offline   Reply With Quote
Old 01-28-2021, 06:11 AM   #13
nindotza
Member
nindotza began at the beginning.
 
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.
nindotza is offline   Reply With Quote
Old 01-28-2021, 06:44 AM   #14
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,853
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
ISBN: {identifiers.isbn}, Whatever: {identifiers.whatever}, ...
kovidgoyal is offline   Reply With Quote
Old 01-28-2021, 07:52 PM   #15
nindotza
Member
nindotza began at the beginning.
 
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.]
nindotza is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 05:34 AM.


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