mirror of
https://github.com/ankitects/anki.git
synced 2025-11-10 22:57:11 -05:00
don't convert newlines into br tags in export
fixes https://anki.tenderapp.com/discussions/ankidesktop/15795-export -error-doubling-br-tags This code dates back a few years, and was probably a naive solution for files breaking when exported with newlines. Ideally we should be preserving the newlines and wrapping the field in quotes, but since some people may be relying on exported files not to be quoted, we'll wait to change this until the next major release. For now, we'll use a space instead, which should not alter the appearance of the rendered HTML.
This commit is contained in:
parent
52f8a4a75e
commit
47940680d2
1 changed files with 4 additions and 2 deletions
|
|
@ -21,11 +21,13 @@ class Exporter(object):
|
|||
|
||||
def escapeText(self, text):
|
||||
"Escape newlines, tabs, CSS and quotechar."
|
||||
text = text.replace("\n", "<br>")
|
||||
# fixme: we should probably quote fields with newlines
|
||||
# instead of converting them to spaces
|
||||
text = text.replace("\n", " ")
|
||||
text = text.replace("\t", " " * 8)
|
||||
text = re.sub("(?i)<style>.*?</style>", "", text)
|
||||
if "\"" in text:
|
||||
text = "\"" + text.replace("\"", "\"\"") + "\""
|
||||
text = "\"" + text.replace("\"", "\"\"") + "\""
|
||||
return text
|
||||
|
||||
def cardIds(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue