add real example to card layout, and move hr like during review

This commit is contained in:
Damien Elmes 2013-05-20 18:21:14 +09:00
parent d90652d0d6
commit 1b12ff6fe5

View File

@ -236,11 +236,19 @@ Please create a new card type first."""))
self.playedAudio[c.id] = True
def maybeTextInput(self, txt, type='q'):
origLen = len(txt)
txt = txt.replace("<hr id=answer>", "")
hadHR = origLen != len(txt)
def answerRepl(match):
res = self.mw.reviewer.correct("exomple", "an example")
if hadHR:
res = "<hr id=answer>" + res
return res
if type == 'q':
repl = "<input id='typeans' type=text value=''>"
else:
repl = _("(typing comparison appears here)")
repl = "<input id='typeans' type=text value='exomple'>"
repl = "<center>%s</center>" % repl
else:
repl = answerRepl
return re.sub("\[\[type:.+?\]\]", repl, txt)
# Card operations