mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#227: Make `literalinclude` work when the document's path
name contains non-ASCII characters.
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,6 +1,9 @@
|
||||
Release 0.6.3 (in development)
|
||||
==============================
|
||||
|
||||
* #227: Make ``literalinclude`` work when the document's path
|
||||
name contains non-ASCII characters.
|
||||
|
||||
* #229: Fix autodoc failures with members that raise errors
|
||||
on ``getattr()``.
|
||||
|
||||
|
||||
@@ -101,7 +101,13 @@ class LiteralInclude(Directive):
|
||||
else:
|
||||
docdir = path.dirname(env.doc2path(env.docname, base=None))
|
||||
rel_fn = path.normpath(path.join(docdir, filename))
|
||||
fn = path.join(env.srcdir, rel_fn)
|
||||
try:
|
||||
fn = path.join(env.srcdir, rel_fn)
|
||||
except UnicodeDecodeError:
|
||||
# the source directory is a bytestring with non-ASCII characters;
|
||||
# let's try to encode the rel_fn in the file system encoding
|
||||
rel_fn = rel_fn.encode(sys.getfilesystemencoding())
|
||||
fn = path.join(env.srcdir, rel_fn)
|
||||
|
||||
if 'pyobject' in self.options and 'lines' in self.options:
|
||||
return [document.reporter.warning(
|
||||
|
||||
Reference in New Issue
Block a user