mirror of
https://github.com/ankitects/anki.git
synced 2025-11-17 10:07:13 -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])
|
||||
|
||||
def mungeQA(deck, txt):
|
||||
txt = renderLatex(deck, txt)
|
||||
txt = stripSounds(txt)
|
||||
def quote(match):
|
||||
match = unicode(match.group(1))
|
||||
if match.lower().startswith("http"):
|
||||
|
|
@ -199,8 +197,12 @@ def mungeQA(deck, txt):
|
|||
src = prefix + unicode(
|
||||
urllib.quote(os.path.join(deck.mediaDir(
|
||||
create=True), match).encode("utf-8")), "utf-8")
|
||||
return 'img src="%s"' % src
|
||||
txt = re.sub('img src="(.*?)"', quote, txt)
|
||||
return src
|
||||
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
|
||||
|
||||
class ProgressWin(object):
|
||||
|
|
|
|||
Loading…
Reference in a new issue