mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
don't insert <br> into text of cards on import
When "allow HTML" was turned off, Anki was replacing newlines with <br>s in the text of the new notes before it escaped HTML characters, so the line breaks were becoming <br>.
This commit is contained in:
parent
5b61db7d0a
commit
ba084cb46a
2 changed files with 4 additions and 3 deletions
|
@ -132,6 +132,6 @@ class TextImporter(NoteImporter):
|
|||
|
||||
def noteFromFields(self, fields):
|
||||
note = ForeignNote()
|
||||
note.fields.extend([x.strip().replace("\n", "<br>") for x in fields])
|
||||
note.fields.extend([x for x in fields])
|
||||
note.tags.extend(self.tagsToAdd)
|
||||
return note
|
||||
|
|
|
@ -120,9 +120,10 @@ class NoteImporter(Importer):
|
|||
dupeCount = 0
|
||||
dupes = []
|
||||
for n in notes:
|
||||
if not self.allowHTML:
|
||||
for c in range(len(n.fields)):
|
||||
for c in range(len(n.fields)):
|
||||
if not self.allowHTML:
|
||||
n.fields[c] = cgi.escape(n.fields[c])
|
||||
n.fields[c] = n.fields[c].strip().replace("\n", "<br>")
|
||||
fld0 = n.fields[fld0idx]
|
||||
csum = fieldChecksum(fld0)
|
||||
# first field must exist
|
||||
|
|
Loading…
Reference in a new issue