Quantcast
Channel: MobileRead Forums
Viewing all articles
Browse latest Browse all 50069

Template language - Conditionally including text

$
0
0
Hi,
I followed the instructions here: https://manual.calibre-ebook.com/template_lang.html and successfully managed to set the save to disk setting to my preferences:
Code:

{series} {series_index:0>2s|#| - }{title} - {authors}
This works very well when saving to disk, so I thought I could use the same technique when customizing my jacket.xhtml template. What I am trying to achieve is having the book's name in it's original language, below the Ttitle. For this I am using a custom column, and I am able to show it without issue if there is data in that column. But what I can't figure out how to do is to have that name in parenthesis like so: (original name). If I add parenthesis to the code, then they would show anyway, even if there is no data in the custom column. I tried this code:
Code:

{_original_name:|(|)}
but it is not working and I get an error when I try to polish the book with this code: ValueError: Invalid format specifier '|(|)' for object of type 'str'

Is there another way to include the parenthesis around the conditional text only if there is data in the custom column?

Viewing all articles
Browse latest Browse all 50069

Latest Images

Trending Articles



Latest Images