TXT Output: Fix line endings setting not being respected on windows

This commit is contained in:
Kovid Goyal 2009-09-22 12:31:43 -06:00
parent af79cbe591
commit 9985700d15

View File

@ -19,7 +19,11 @@ class TxtNewlines(object):
self.newline = self.NEWLINE_TYPES.get(newline_type.lower(), os.linesep)
def specified_newlines(newline, text):
# Convert all newlines to \n
text = text.replace('\r\n', '\n')
text = text.replace('\r', '\n')
if newline == '\n':
return text
return text.replace(os.linesep, newline)
return text.replace('\n', newline)