add automatic <br> back to field references

{{Front}}
{{Back}}

will now automatically add a <br> to the first field reference, like previous
Anki versions did. The <br> is too complicated for users who just want a plain
template without any HTML.
This commit is contained in:
Damien Elmes 2013-01-15 08:28:39 +09:00
parent dec480844b
commit 05a68488e7

View File

@ -492,8 +492,8 @@ where c.nid = n.id and c.id in %s group by nid""" % ids2str(cids)):
fields['c%d' % (data[4]+1)] = "1"
# render q & a
d = dict(id=data[0])
qfmt = qfmt or template['qfmt']
afmt = afmt or template['afmt']
qfmt = (qfmt or template['qfmt']).replace("}}\n", "}}<br>")
afmt = (afmt or template['afmt']).replace("}}\n", "}}<br>")
for (type, format) in (("q", qfmt), ("a", afmt)):
if type == "q":
format = format.replace("{{cloze:", "{{cq:%d:" % (