move filter reversal into pystache

This commit is contained in:
Damien Elmes 2020-01-08 18:59:05 +10:00
parent b014822253
commit 031c4e814f
2 changed files with 2 additions and 3 deletions

View file

@ -141,6 +141,8 @@ class Template:
if txt is None: if txt is None:
return "{unknown field %s}" % tag_name return "{unknown field %s}" % tag_name
# the filter closest to the field name is applied first
mods.reverse()
return apply_field_filters(tag, txt, context, mods) return apply_field_filters(tag, txt, context, mods)
@modifier("=") @modifier("=")

View file

@ -80,9 +80,6 @@ def apply_field_filters(
def _sort_filters(filters: List[str]): def _sort_filters(filters: List[str]):
"Mutate the list of filters into the correct order." "Mutate the list of filters into the correct order."
# the filter closest to the field name is applied first
filters.reverse()
# Since 'text:' and other mods can affect html on which Anki relies to # Since 'text:' and other mods can affect html on which Anki relies to
# process clozes, we need to make sure clozes are always # process clozes, we need to make sure clozes are always
# treated after all the other mods, regardless of how they're specified # treated after all the other mods, regardless of how they're specified