mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
fix importing of multiline fields
This commit is contained in:
parent
13049339ac
commit
c1242740ac
1 changed files with 2 additions and 2 deletions
|
@ -67,7 +67,7 @@ class TextImporter(NoteImporter):
|
||||||
self.data = self.data[len(codecs.BOM_UTF8):]
|
self.data = self.data[len(codecs.BOM_UTF8):]
|
||||||
def sub(s):
|
def sub(s):
|
||||||
return re.sub("^\#.*", "", s)
|
return re.sub("^\#.*", "", s)
|
||||||
self.data = [sub(x) for x in self.data.split("\n") if sub(x)]
|
self.data = [sub(x)+"\n" for x in self.data.split("\n") if sub(x)]
|
||||||
if self.data:
|
if self.data:
|
||||||
if self.data[0].startswith("tags:"):
|
if self.data[0].startswith("tags:"):
|
||||||
self.tagsToAdd = self.data[0][5:].split(" ")
|
self.tagsToAdd = self.data[0][5:].split(" ")
|
||||||
|
@ -119,6 +119,6 @@ class TextImporter(NoteImporter):
|
||||||
|
|
||||||
def noteFromFields(self, fields):
|
def noteFromFields(self, fields):
|
||||||
note = ForeignNote()
|
note = ForeignNote()
|
||||||
note.fields.extend([x.strip() for x in fields])
|
note.fields.extend([x.strip().replace("\n", "<br>") for x in fields])
|
||||||
note.tags.extend(self.tagsToAdd)
|
note.tags.extend(self.tagsToAdd)
|
||||||
return note
|
return note
|
||||||
|
|
Loading…
Reference in a new issue