ignore html in conditional tags

This commit is contained in:
Damien Elmes 2013-01-29 09:14:28 +09:00
parent 073f129ab8
commit 1203775aef

View File

@ -1,5 +1,5 @@
import re
from anki.utils import stripHTML
from anki.utils import stripHTML, stripHTMLMedia
from anki.hooks import runFilter
from anki.template import furigana; furigana.install()
from anki.template import hint; hint.install()
@ -99,6 +99,8 @@ class Template(object):
replacer = ''
# if it and isinstance(it, collections.Callable):
# replacer = it(inner)
if isinstance(it, basestring):
it = stripHTMLMedia(it).strip()
if it and not hasattr(it, '__iter__'):
if section[2] != '^':
replacer = inner