From 031c4e814f7413df217cae968bdc19ee87884855 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 8 Jan 2020 18:59:05 +1000 Subject: [PATCH] move filter reversal into pystache --- pylib/anki/template/template.py | 2 ++ pylib/anki/template2.py | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pylib/anki/template/template.py b/pylib/anki/template/template.py index 127c2092e..634dcb8fa 100644 --- a/pylib/anki/template/template.py +++ b/pylib/anki/template/template.py @@ -141,6 +141,8 @@ class Template: if txt is None: 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) @modifier("=") diff --git a/pylib/anki/template2.py b/pylib/anki/template2.py index ebabad032..bde7a4197 100644 --- a/pylib/anki/template2.py +++ b/pylib/anki/template2.py @@ -80,9 +80,6 @@ def apply_field_filters( def _sort_filters(filters: List[str]): "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 # process clozes, we need to make sure clozes are always # treated after all the other mods, regardless of how they're specified