mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 23:12:21 -04:00
support filtering question and answer
This commit is contained in:
parent
3a61d2ca72
commit
b985424ac3
1 changed files with 3 additions and 1 deletions
|
@ -8,7 +8,7 @@ import anki, anki.utils
|
||||||
from anki.sound import playFromText, stripSounds
|
from anki.sound import playFromText, stripSounds
|
||||||
from anki.latex import renderLatex, stripLatex
|
from anki.latex import renderLatex, stripLatex
|
||||||
from anki.utils import stripHTML
|
from anki.utils import stripHTML
|
||||||
from anki.hooks import runHook
|
from anki.hooks import runHook, runFilter
|
||||||
import types, time, re, os, urllib, sys, difflib
|
import types, time, re, os, urllib, sys, difflib
|
||||||
from ankiqt import ui
|
from ankiqt import ui
|
||||||
from ankiqt.ui.utils import mungeQA, getBase
|
from ankiqt.ui.utils import mungeQA, getBase
|
||||||
|
@ -136,6 +136,7 @@ class View(object):
|
||||||
height = 35
|
height = 35
|
||||||
else:
|
else:
|
||||||
height = 45
|
height = 45
|
||||||
|
q = runFilter("drawQuestion", q)
|
||||||
self.write(self.center(self.mungeQA(self.main.deck, q), height))
|
self.write(self.center(self.mungeQA(self.main.deck, q), height))
|
||||||
if self.state != self.oldState and not nosound:
|
if self.state != self.oldState and not nosound:
|
||||||
playFromText(q)
|
playFromText(q)
|
||||||
|
@ -168,6 +169,7 @@ class View(object):
|
||||||
def drawAnswer(self):
|
def drawAnswer(self):
|
||||||
"Show the answer."
|
"Show the answer."
|
||||||
a = self.main.currentCard.htmlAnswer()
|
a = self.main.currentCard.htmlAnswer()
|
||||||
|
a = runFilter("drawAnswer", a)
|
||||||
if self.main.currentCard.cardModel.typeAnswer:
|
if self.main.currentCard.cardModel.typeAnswer:
|
||||||
try:
|
try:
|
||||||
cor = stripHTML(self.main.currentCard.fact[
|
cor = stripHTML(self.main.currentCard.fact[
|
||||||
|
|
Loading…
Reference in a new issue