From 611fcf7112b34ef4948ca9c51df8d2ef9a4c662c Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Mon, 26 Jan 2009 22:41:22 +0100 Subject: [PATCH] Open literalinclude files in universal newline mode to allow arbitrary newline conventions. --- CHANGES | 3 +++ sphinx/directives/code.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 05cab5366..7e343b882 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ Release 0.5.2 (in development) ============================== +* Open literalinclude files in universal newline mode to allow + arbitrary newline conventions. + * Actually make the ``-Q`` option work. * #86: Fix explicit document titles in toctrees. diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py index 5a438886a..8ce2eed91 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -70,7 +70,7 @@ def literalinclude_directive(name, arguments, options, content, lineno, encoding = options.get('encoding', env.config.source_encoding) try: - f = codecs.open(fn, 'r', encoding) + f = codecs.open(fn, 'rU', encoding) text = f.read() f.close() except (IOError, OSError):