mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
* Fix: Non-ASCII filename raise exception on make singlehtml, latex, man, texinfo and changes. Closes #1508
This commit is contained in:
parent
e2ed97031d
commit
269421bc58
2
CHANGES
2
CHANGES
@ -23,6 +23,8 @@ Bugs fixed
|
|||||||
exception and emits warnings without unexpected termination.
|
exception and emits warnings without unexpected termination.
|
||||||
* #1503: py:function directive generate incorrectly signature when specifying
|
* #1503: py:function directive generate incorrectly signature when specifying
|
||||||
a default parameter with an empty list `[]`. Thanks to Geert Jansen.
|
a default parameter with an empty list `[]`. Thanks to Geert Jansen.
|
||||||
|
* #1508: Non-ASCII filename raise exception on make singlehtml, latex, man,
|
||||||
|
texinfo and changes.
|
||||||
|
|
||||||
Release 1.2.2 (released Mar 2, 2014)
|
Release 1.2.2 (released Mar 2, 2014)
|
||||||
====================================
|
====================================
|
||||||
|
@ -124,14 +124,15 @@ class ChangesBuilder(Builder):
|
|||||||
|
|
||||||
self.info(bold('copying source files...'))
|
self.info(bold('copying source files...'))
|
||||||
for docname in self.env.all_docs:
|
for docname in self.env.all_docs:
|
||||||
f = codecs.open(self.env.doc2path(docname), 'r', 'latin1')
|
f = codecs.open(self.env.doc2path(docname), 'r',
|
||||||
|
self.env.config.source_encoding)
|
||||||
try:
|
try:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
finally:
|
finally:
|
||||||
f.close()
|
f.close()
|
||||||
targetfn = path.join(self.outdir, 'rst', os_path(docname)) + '.html'
|
targetfn = path.join(self.outdir, 'rst', os_path(docname)) + '.html'
|
||||||
ensuredir(path.dirname(targetfn))
|
ensuredir(path.dirname(targetfn))
|
||||||
f = codecs.open(targetfn, 'w', 'latin1')
|
f = codecs.open(targetfn, 'w', 'utf-8')
|
||||||
try:
|
try:
|
||||||
text = ''.join(hl(i+1, line) for (i, line) in enumerate(lines))
|
text = ''.join(hl(i+1, line) for (i, line) in enumerate(lines))
|
||||||
ctx = {
|
ctx = {
|
||||||
|
@ -186,7 +186,7 @@ def inline_all_toctrees(builder, docnameset, docname, tree, colorfunc):
|
|||||||
tree = tree.deepcopy()
|
tree = tree.deepcopy()
|
||||||
for toctreenode in tree.traverse(addnodes.toctree):
|
for toctreenode in tree.traverse(addnodes.toctree):
|
||||||
newnodes = []
|
newnodes = []
|
||||||
includefiles = map(str, toctreenode['includefiles'])
|
includefiles = map(unicode, toctreenode['includefiles'])
|
||||||
for includefile in includefiles:
|
for includefile in includefiles:
|
||||||
try:
|
try:
|
||||||
builder.info(colorfunc(includefile) + " ", nonl=1)
|
builder.info(colorfunc(includefile) + " ", nonl=1)
|
||||||
|
@ -18,16 +18,14 @@ except ImportError:
|
|||||||
ManWriter = None
|
ManWriter = None
|
||||||
|
|
||||||
|
|
||||||
builder_names = ['pickle', 'json', 'linkcheck', 'text', 'htmlhelp', 'qthelp',
|
|
||||||
'epub', 'changes', 'singlehtml', 'xml', 'pseudoxml']
|
|
||||||
|
|
||||||
|
|
||||||
def teardown_module():
|
def teardown_module():
|
||||||
(test_root / '_build').rmtree(True)
|
(test_root / '_build').rmtree(True)
|
||||||
|
|
||||||
|
|
||||||
def test_build():
|
def test_build():
|
||||||
for buildername in builder_names:
|
for buildername in ('pickle', 'json', 'linkcheck', 'text', 'htmlhelp',
|
||||||
|
'qthelp', 'epub', 'changes', 'singlehtml', 'xml',
|
||||||
|
'pseudoxml'):
|
||||||
app = TestApp(buildername=buildername)
|
app = TestApp(buildername=buildername)
|
||||||
yield lambda app: app.builder.build_all(), app
|
yield lambda app: app.builder.build_all(), app
|
||||||
app.cleanup()
|
app.cleanup()
|
||||||
@ -41,8 +39,7 @@ def test_man(app):
|
|||||||
assert (app.outdir / 'SphinxTests.1').exists()
|
assert (app.outdir / 'SphinxTests.1').exists()
|
||||||
|
|
||||||
|
|
||||||
@with_app(buildername='html', srcdir='(temp)')
|
def _test_nonascii_path(app):
|
||||||
def test_nonascii_path(app):
|
|
||||||
srcdir = path(app.srcdir)
|
srcdir = path(app.srcdir)
|
||||||
mb_name = u'\u65e5\u672c\u8a9e'
|
mb_name = u'\u65e5\u672c\u8a9e'
|
||||||
try:
|
try:
|
||||||
@ -63,6 +60,22 @@ def test_nonascii_path(app):
|
|||||||
.. toctree::
|
.. toctree::
|
||||||
|
|
||||||
%(mb_name)s/%(mb_name)s
|
%(mb_name)s/%(mb_name)s
|
||||||
""" % locals())
|
""" % {'mb_name': mb_name})
|
||||||
).encode('utf-8'))
|
).encode('utf-8'))
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
|
|
||||||
|
|
||||||
|
def test_nonascii_path():
|
||||||
|
(test_root / '_build').rmtree(True) #keep this to build first gettext
|
||||||
|
|
||||||
|
builder_names = ['gettext', 'html', 'dirhtml', 'singlehtml', 'latex',
|
||||||
|
'texinfo', 'pickle', 'json', 'linkcheck', 'text',
|
||||||
|
'htmlhelp', 'qthelp', 'epub', 'changes', 'xml',
|
||||||
|
'pseudoxml']
|
||||||
|
if ManWriter is not None:
|
||||||
|
builder_names.append('man')
|
||||||
|
|
||||||
|
for buildername in builder_names:
|
||||||
|
app = TestApp(buildername=buildername, srcdir='(temp)')
|
||||||
|
yield _test_nonascii_path, app
|
||||||
|
app.cleanup()
|
||||||
|
Loading…
Reference in New Issue
Block a user