match the whole {{xx:yy]] field so we can delete it

This commit is contained in:
ospalh 2012-05-04 12:13:47 +02:00
parent 3173073cff
commit 311897a393

View file

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