View Single Post
Old 04-02-2024, 01:44 AM   #2
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,753
Karma: 62032371
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Yes. See the template documentation: https://manual.calibre-ebook.com/template_lang.html


Single-function template is pretty limited here though. Personally, what I do is have a custom GPM template in a composite (column built from other column) column, #kobopath, to generate the value I want.. Then I insert it into the save template:

Code:
{#kobopath}/{title} - {author_sort:sublist(0,1,&)}

For tags and tag-like columns, the list functions such as list_re() and list_split() are your friend here. As an example, this template will take the first available 'Fanfiction.Whatever' tag and turn it into 'Fanfiction\Whatever':

Code:
program:

list_split(list_re($tags, ',', '^Fanfiction.(.*)$', 'Fanfiction/\1'), ',', 'ff');
If you're checking for formats, use approximate_formats() as it's far faster.

Last edited by ownedbycats; 04-02-2024 at 07:45 AM.
ownedbycats is online now   Reply With Quote