View Single Post
Old 07-05-2023, 04:02 PM   #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: 11,037
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
https://manual.calibre-ebook.com/template_lang.html

In particular, check out the various list functions. For #1, list_difference() can remove entries. Regexes are helpful here.

If it helps to see examples, here's an old version of my #subjects composite.

Code:
program:

tags = $tags;

	if 
		'^(Fiction|Nonfiction|Magazines & Publications)' in $#booktype 
	then 
## Split tags or return an empty
		split_tags = re(tags, '\.', ',') 
	else
		split_tags = ''
	fi;

## Removing a few unwanteds and sorting
	cleaned_tags = list_sort(list_difference(
		split_tags,
		'[Cleanup], Fiction, Nonfiction, Magazines & Publications, Cultures & Regions, Topics',
		','), 0, ',');

## Add 'Omnibus' if applicable
	if 
		'omnibus' 
	in 
		$#admintags 
	then 
		cleaned_tags  = 'Omnibus' & if cleaned_tags then ', ' & cleaned_tags fi
	fi;

	cleaned_tags

For #3, there really isn't a way to automatically count chapters and any method to do so would probably be fairly unreliable. I use 'Edit ToC' (a bit faster than opening the book), check there, and then manually input.

Last edited by ownedbycats; 07-05-2023 at 04:07 PM.
ownedbycats is offline   Reply With Quote