Quote:
Originally Posted by ownedbycats
New question:
[...]
Is there a way to do either of the following?
1. Tell it to skip to the next tag if it finds [Cleanup].
2. Tell it to search for the first (foo|bar) tag, where the pattern matches the enumerated values.
I suspect the latter would be a better option as I sometimes don't clean up bulk-imported tags first, so something like 'Animals' or 'Biography' would come up before Fiction|Nonfiction.
Thanks. 
|
First issue: the idea of "first". There is no guaranteed order of the tags in the list. Second: there isn't a template function that returns the valid values for an enumerated column.
If you mean "match any of a list of tags such as "Fiction|Nonfiction" then you can do that.
Code:
program:
if $#fanficcat then 'Fanfiction'
elif $#manualtype then 'Documentation & Manuals'
else
t = list_intersection($tags, "Fiction, Nonfiction", ',');
re(sublist(t, 0, 1, ','), '^(.*?)($|\..*$)', '\1')
fi
That said, I don't know what the re() is doing so I don't know whether what I suggest can work. It looks like it is trying to isolate the first part of a hierarchical tag. If so then this might work by getting the first of an acceptable value:
Code:
program:
if $#fanficcat then 'Fanfiction'
elif $#manualtype then 'Documentation & Manuals'
else
sublist(list_intersection(subitems($tags, 0, 1), "Fiction, Nonfiction", ','), 0, 1, ',')
fi