@cryosaur -
First off, I'll tell you the same thing I tell everyone trying to normalize AO3 metadata: it's going to be a lot of work and it's never going to be perfect as long as AO3 allows authors to enter whatever they want.
As for the possible bug:
The way it works is that
include/exclude_pre then
replace_metadata then
include/exclude_post are applied to
each metadata entry as it's used, not all metadata as a whole.
So when you use
warnings in a conditional clause, the
pre,
replace_metadata and post lines for
warnings are applied to it before it is used.
I can see where that fact is non-intuitive. I'm going to look at the wiki pages and add some documentation about that.
There are ways to accomplish what you want even with that limitation:
Create a new metadata entry containing a copy of
warnings that isn't edited for conditionals:
Code:
# Partial solution
[archiveofourown.org]
add_to_extra_valid_entries:,rawwarnings
include_in_rawwarnings:warnings.NOREPL
add_to_replace_metadata:
freeformtags=>(.*)=>\1\,Violence&&rawwarnings=>Graphic Depictions Of Violence
exclude_metadata_post:
warnings==Graphic Depictions Of Violence
But as you noticed, if there's nothing in
freeformtags, the replacement isn't made.
IMO, it's better the create a new metadata entry containing a copy of
warnings that you apply your edits and filters to that you include in
freeformtags:
Code:
# More complete solution
[archiveofourown.org]
add_to_extra_valid_entries:,abbrevwarnings
include_in_abbrevwarnings:warnings.NOREPL
include_in_freeformtags:freeformtags,abbrevwarnings
add_to_replace_metadata:
abbrevwarnings=>^Graphic Depictions Of Violence$=>Violence
abbrevwarnings=>^Major Character Death$=>Death
include_metadata_post:
abbrevwarnings==Violence
abbrevwarnings==Death
exclude_metadata_post:
warnings==Graphic Depictions Of Violence
warnings==Major Character Death