mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
strip field model html on text card export
This commit is contained in:
parent
c1d778971f
commit
f636b71b8c
1 changed files with 3 additions and 2 deletions
|
@ -8,7 +8,7 @@ Exporting support
|
||||||
"""
|
"""
|
||||||
__docformat__ = 'restructuredtext'
|
__docformat__ = 'restructuredtext'
|
||||||
|
|
||||||
import itertools, time
|
import itertools, time, re
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
from anki import DeckStorage
|
from anki import DeckStorage
|
||||||
from anki.cards import Card
|
from anki.cards import Card
|
||||||
|
@ -28,9 +28,10 @@ class Exporter(object):
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
def escapeText(self, text):
|
def escapeText(self, text):
|
||||||
"Escape newlines and tabs."
|
"Escape newlines and tabs, and strip Anki HTML."
|
||||||
text = text.replace("\n", "<br>")
|
text = text.replace("\n", "<br>")
|
||||||
text = text.replace("\t", " " * 8)
|
text = text.replace("\t", " " * 8)
|
||||||
|
text = re.sub('<span class="fm.*"?>(.*?)</span>', '\\1', text)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def cardIds(self):
|
def cardIds(self):
|
||||||
|
|
Loading…
Reference in a new issue