make sure we don't chomp embedded newlines when clearing comments (#722)
This commit is contained in:
parent
3be7c998fc
commit
a525d3c32c
@ -32,14 +32,15 @@ class TextImporter(NoteImporter):
|
||||
for row in reader:
|
||||
row = [unicode(x, "utf-8") for x in row]
|
||||
if len(row) != self.numFields:
|
||||
log.append(_(
|
||||
"'%(row)s' had %(num1)d fields, "
|
||||
"expected %(num2)d") % {
|
||||
"row": u" ".join(row),
|
||||
"num1": len(row),
|
||||
"num2": self.numFields,
|
||||
})
|
||||
ignored += 1
|
||||
if row:
|
||||
log.append(_(
|
||||
"'%(row)s' had %(num1)d fields, "
|
||||
"expected %(num2)d") % {
|
||||
"row": u" ".join(row),
|
||||
"num1": len(row),
|
||||
"num2": self.numFields,
|
||||
})
|
||||
ignored += 1
|
||||
continue
|
||||
note = self.noteFromFields(row)
|
||||
notes.append(note)
|
||||
@ -65,8 +66,8 @@ class TextImporter(NoteImporter):
|
||||
if self.data.startswith(codecs.BOM_UTF8):
|
||||
self.data = self.data[len(codecs.BOM_UTF8):]
|
||||
def sub(s):
|
||||
return re.sub("^\#.*", "", s)
|
||||
self.data = [sub(x)+"\n" for x in self.data.split("\n") if sub(x)]
|
||||
return re.sub("^\#.*$", "__comment", s)
|
||||
self.data = [sub(x)+"\n" for x in self.data.split("\n") if sub(x) != "__comment"]
|
||||
if self.data:
|
||||
if self.data[0].startswith("tags:"):
|
||||
tags = unicode(self.data[0][5:], "utf8").strip()
|
||||
|
Loading…
Reference in New Issue
Block a user