View Single Post
Old 12-27-2020, 02:22 PM   #9
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,054
Karma: 75568269
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Question: There's a number of specific tags I'd like to remove, but not their children. (e.g. Fiction.Cultures & Regions.Canada or Fiction.Social Issues.Prejudice & Racism - in these cases "Cultures & Regions" and "Social Issues" are just organizational tags and I don't need them to appear in the lists.)

Is this along the right lines? No errors, but it didn't actually remove the tags.

Code:
program:
	g = field('tags');
	stripped_hierarchies = list_re_group(g, ',', '.',
			'^(Fanfiction|Documentation and Manuals)($|\..*$)',
			'(Cultures & Regions|Social Issues)',
			'{$}', '');
	split_hierarchies = re(stripped_hierarchies, '\.', ',');
	cleaned = list_union('', split_hierarchies, ',');
	sorted = list_sort(cleaned, 0, ',')

Last edited by ownedbycats; 12-27-2020 at 02:29 PM.
ownedbycats is offline   Reply With Quote