mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 00:12:25 -04:00
add type-in-the-answer note type
This commit is contained in:
parent
c8127ee606
commit
a353135af3
2 changed files with 21 additions and 1 deletions
|
@ -26,6 +26,25 @@ def addBasicModel(col):
|
||||||
|
|
||||||
models.append((lambda: _("Basic"), addBasicModel))
|
models.append((lambda: _("Basic"), addBasicModel))
|
||||||
|
|
||||||
|
# Basic w/ typing
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
def addBasicTypingModel(col):
|
||||||
|
mm = col.models
|
||||||
|
m = mm.new(_("Basic (type in the answer)"))
|
||||||
|
fm = mm.newField(_("Front"))
|
||||||
|
mm.addField(m, fm)
|
||||||
|
fm = mm.newField(_("Back"))
|
||||||
|
mm.addField(m, fm)
|
||||||
|
t = mm.newTemplate(_("Card 1"))
|
||||||
|
t['qfmt'] = "{{"+_("Front")+"}}\n{{type:"+_("Back")+"}}"
|
||||||
|
t['afmt'] = "{{FrontSide}}\n\n<hr id=answer>\n\n"+"{{"+_("Back")+"}}"
|
||||||
|
mm.addTemplate(m, t)
|
||||||
|
mm.add(m)
|
||||||
|
return m
|
||||||
|
|
||||||
|
models.append((lambda: _("Basic (type in the answer)"), addBasicTypingModel))
|
||||||
|
|
||||||
# Forward & Reverse
|
# Forward & Reverse
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ from anki.db import DB
|
||||||
from anki.collection import _Collection
|
from anki.collection import _Collection
|
||||||
from anki.consts import *
|
from anki.consts import *
|
||||||
from anki.stdmodels import addBasicModel, addClozeModel, addForwardReverse, \
|
from anki.stdmodels import addBasicModel, addClozeModel, addForwardReverse, \
|
||||||
addForwardOptionalReverse
|
addForwardOptionalReverse, addBasicTypingModel
|
||||||
|
|
||||||
def Collection(path, lock=True, server=False, sync=True, log=False):
|
def Collection(path, lock=True, server=False, sync=True, log=False):
|
||||||
"Open a new or existing collection. Path must be unicode."
|
"Open a new or existing collection. Path must be unicode."
|
||||||
|
@ -43,6 +43,7 @@ def Collection(path, lock=True, server=False, sync=True, log=False):
|
||||||
elif create:
|
elif create:
|
||||||
# add in reverse order so basic is default
|
# add in reverse order so basic is default
|
||||||
addClozeModel(col)
|
addClozeModel(col)
|
||||||
|
addBasicTypingModel(col)
|
||||||
addForwardOptionalReverse(col)
|
addForwardOptionalReverse(col)
|
||||||
addForwardReverse(col)
|
addForwardReverse(col)
|
||||||
addBasicModel(col)
|
addBasicModel(col)
|
||||||
|
|
Loading…
Reference in a new issue