View Single Post
Old 04-07-2024, 03:41 PM   #2
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: 12,465
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by flasunco View Post
Hey all,

I have the problem that no functions used in a template are evaluated (or parsed). Meaning, the function call itself will be part of the output.

I first tried to get the pubdate year, but now noticed that nothing seems to work (see the capitalize call).

Template:
Code:
{author_sort}/
{series:||{series_index:| #|} - }
{title} ({pubdate})/
{authors} - 
{series:||{series_index:| #|} - }
{title} 

(format_date_field('pubdate', 'yyyy'))
format_date(field('pubdate'), 'yyyy')
capitalize('asdf')

Output:
Code:
Sands, Philippe/ East West Street: On the Origins of "Genocide" and "Crimes Against Humanity" (Apr 2016)/ Philippe Sands - East West Street: On the Origins of "Genocide" and "Crimes Against Humanity" (format_date_field('pubdate', 'yyyy')) format_date(field('pubdate'), 'yyyy') capitalize('asdf')
Any help would be appreciated.
The bits in bold are not valid expressions in any form of the template language. In addition, there is no 'format_date_field' function. The template expressions before the bold bits are working, as shown by your output. I suggest you look at the template language manual.

I suspect that you want this, using Single Function Mode:
Code:
{author_sort}/
{series:||{series_index:| #|} - }
{title} ({pubdate:format_date('yyyy')})/
{authors} - 
{series:||{series_index:| #|} - }
{title}
Do note that if you are using that template as a file name template, it can generate very long names. These will be shortened by calibre to fit within the 255 character file name limit. The results of the shortening process can appear to be random, even though they aren't.
chaley is offline   Reply With Quote