Code:
program:
## Splitting tags
if
'^(Fiction|Nonfiction)' in $#booktype
then
split_tags = re($tags, '\.', ',')
fi;
## Removing a few unwanteds
cleaned_tags = list_difference(
split_tags,
'Fiction, Nonfiction, Cultures & Regions, Social Issues',
',');
Three things this template to do:
1. Retrieve tags when the booktype is Fiction|Nonfiction.
2. Replace the '.' with a ',' to turn hierarchical tags into a list.
3. Remove a few unwanted entries from the list.
It works... mostly. If booktype is
not Fiction|Nonfiction, it returns
EXCEPTION: Interpreter: Unknown identifier 'split_tags' - line number 12. What should I do?
EDIT: I found that also adding a second if-then check for Fiction|Nonfiction before cleaning the tags works.