mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#414: fix universal newline handling of files included with "literalinclude".
codecs.open() does not support U in the mode argument; use the EncodedFile wrapper instead.
This commit is contained in:
parent
2477249d42
commit
cbf309fa65
3
CHANGES
3
CHANGES
@ -1,6 +1,9 @@
|
||||
Release 0.6.6 (in development)
|
||||
==============================
|
||||
|
||||
* #414: Fix handling of Windows newlines in files included with
|
||||
the ``literalinclude`` directive.
|
||||
|
||||
* #377: Fix crash in linkcheck builder.
|
||||
|
||||
* #387: Fix the display of search results in ``dirhtml`` output.
|
||||
|
@ -116,7 +116,7 @@ class LiteralInclude(Directive):
|
||||
|
||||
encoding = self.options.get('encoding', env.config.source_encoding)
|
||||
try:
|
||||
f = codecs.open(fn, 'rU', encoding)
|
||||
f = codecs.EncodedFile(open(fn, 'U'), encoding)
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
except (IOError, OSError):
|
||||
|
Loading…
Reference in New Issue
Block a user