rename fields in template properly when more than one modifier used

Previously something like {{type:cloze:Text}} in the template would not
be renamed when the field was renamed.
This commit is contained in:
Soren I. Bjornstad 2014-08-11 11:33:39 -05:00
parent a479bc7c48
commit 625d7d5a82

View File

@ -304,10 +304,10 @@ and notes.mid = ? and cards.ord = ?""", m['id'], ord)
def renameField(self, m, field, newName):
self.col.modSchema()
pat = r'{{([:#^/]|[^:#/^}][^:}]*?:|)%s}}'
pat = r'{{(.*)([:#^/]|[^:#/^}][^:}]*?:|)%s}}'
def wrap(txt):
def repl(match):
return '{{' + match.group(1) + txt + '}}'
return '{{' + match.group(1) + match.group(2) + txt + '}}'
return repl
for t in m['tmpls']:
for fmt in ('qfmt', 'afmt'):