mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
don't throw error in half-complete field filter
This commit is contained in:
parent
71645aacb5
commit
1077c71c2e
2 changed files with 8 additions and 1 deletions
|
@ -186,7 +186,8 @@ class Template(object):
|
|||
return ""
|
||||
else:
|
||||
# hook-based field modifier
|
||||
txt = runFilter('fmod_' + mod, txt, extra, context, tag, tag_name);
|
||||
txt = runFilter('fmod_' + mod, txt or '', extra, context,
|
||||
tag, tag_name);
|
||||
if txt is None:
|
||||
return '{unknown field %s}' % tag_name
|
||||
return txt
|
||||
|
|
|
@ -147,6 +147,7 @@ def test_furigana():
|
|||
deck = getEmptyDeck()
|
||||
mm = deck.models
|
||||
m = mm.current()
|
||||
# filter should work
|
||||
m['tmpls'][0]['qfmt'] = '{{kana:Front}}'
|
||||
mm.save(m)
|
||||
n = deck.newNote()
|
||||
|
@ -154,6 +155,11 @@ def test_furigana():
|
|||
deck.addNote(n)
|
||||
c = n.cards()[0]
|
||||
assert c.q().endswith("abc")
|
||||
# and should avoid sound
|
||||
n['Front'] = 'foo[sound:abc.mp3]'
|
||||
n.flush()
|
||||
assert "sound:" in c.q(reload=True)
|
||||
# it shouldn't throw an error while people are editing
|
||||
m['tmpls'][0]['qfmt'] = '{{kana:}}'
|
||||
mm.save(m)
|
||||
c.q(reload=True)
|
||||
|
|
Loading…
Reference in a new issue