From: Robert BÅ‚aut Date: Wed, 29 Jan 2014 14:48:48 +0000 (+0100) Subject: [txt] return Windows friendly txt file with \r\n line ends instead of \n X-Git-Tag: 1.7~104^2~9 X-Git-Url: https://git.mdrn.pl/librarian.git/commitdiff_plain/3ff49a787a8fa5e6a7a7e6e72caf6579ceb2c0a2?ds=sidebyside;hp=2429c45a7e3b8e3ef24794b9c982ffcf121acdbd [txt] return Windows friendly txt file with \r\n line ends instead of \n POSIX editors recognize Windows line end. Notepad on Windows does not recognize POSIX line ends. --- diff --git a/librarian/text.py b/librarian/text.py index 9a4fd7a..9edfa62 100644 --- a/librarian/text.py +++ b/librarian/text.py @@ -82,7 +82,7 @@ def transform(wldoc, flags=None, **options): source = "" contributors = "" funders = "" - return OutputFile.from_string((TEMPLATE % { + result = (TEMPLATE % { 'description': description, 'url': url, 'license_description': license_description, @@ -90,7 +90,8 @@ def transform(wldoc, flags=None, **options): 'source': source, 'contributors': contributors, 'funders': funders, - }).encode('utf-8')) + }).encode('utf-8') else: - return OutputFile.from_string(unicode(result).encode('utf-8')) + result = unicode(result).encode('utf-8') + return OutputFile.from_string("\r\n".join(result.splitlines()))