mirror of
https://github.com/ankitects/anki.git
synced 2025-11-17 18:17:12 -05:00
refactor quoteImg()
This commit is contained in:
parent
7c26cf7a36
commit
a528f71d5c
1 changed files with 6 additions and 4 deletions
|
|
@ -185,8 +185,6 @@ def restoreHeader(widget, key):
|
||||||
widget.restoreState(ankiqt.mw.config[key])
|
widget.restoreState(ankiqt.mw.config[key])
|
||||||
|
|
||||||
def mungeQA(deck, txt):
|
def mungeQA(deck, txt):
|
||||||
txt = renderLatex(deck, txt)
|
|
||||||
txt = stripSounds(txt)
|
|
||||||
def quote(match):
|
def quote(match):
|
||||||
match = unicode(match.group(1))
|
match = unicode(match.group(1))
|
||||||
if match.lower().startswith("http"):
|
if match.lower().startswith("http"):
|
||||||
|
|
@ -199,8 +197,12 @@ def mungeQA(deck, txt):
|
||||||
src = prefix + unicode(
|
src = prefix + unicode(
|
||||||
urllib.quote(os.path.join(deck.mediaDir(
|
urllib.quote(os.path.join(deck.mediaDir(
|
||||||
create=True), match).encode("utf-8")), "utf-8")
|
create=True), match).encode("utf-8")), "utf-8")
|
||||||
return 'img src="%s"' % src
|
return src
|
||||||
txt = re.sub('img src="(.*?)"', quote, txt)
|
def quoteImg(match):
|
||||||
|
return 'img src="%s"' % quote(match)
|
||||||
|
txt = renderLatex(deck, txt)
|
||||||
|
txt = stripSounds(txt)
|
||||||
|
txt = re.sub('img src="(.*?)"', quoteImg, txt)
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
class ProgressWin(object):
|
class ProgressWin(object):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue