View Single Post
Old 10-24-2021, 03:49 PM   #3
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,104
Karma: 77213681
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I have a composite column that splits and de-dupes the tags. Mostly because the long hierarchical tags look awful in the book details pane.

But an additional effect is that clicking on "Atlantic Canada" in the details pane will display books for Fiction.Cultures & Regions.Canada.Atlantic Canada,
Nonfiction.Travel Guides.Canada.Atlantic Canada,
and Nonfiction.History.Canada.Atlantic Canada.

Code:
program:
	g = field('tags');

	stripped_hierarchies = list_re_group(g, ',', '.',
# This ignores any subtags under specific top-level tags. I have separate columns for them.
			'^(Fanfiction|Documentation & Manuals)($|\..*$)',
			'{$}', '');
	split_hierarchies = re(stripped_hierarchies, '\.', ',');
	split_hierarchies = list_difference(
			split_hierarchies,
# These are tags to explicitly ignore.
			'@cleanup, Cultures & Regions',
			',');
	cleaned = list_union('', split_hierarchies, ',');
# Remove or comment this next line to get rid of the alphanetical sorting.
	sorted = list_sort(cleaned, 0, ',')
ownedbycats is offline   Reply With Quote