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.
|
||||
* #1503: py:function directive generate incorrectly signature when specifying
|
||||
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)
|
||||
====================================
|
||||
|
@ -124,14 +124,15 @@ class ChangesBuilder(Builder):
|
||||
|
||||
self.info(bold('copying source files...'))
|
||||
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:
|
||||
lines = f.readlines()
|
||||
finally:
|
||||
f.close()
|
||||
targetfn = path.join(self.outdir, 'rst', os_path(docname)) + '.html'
|
||||
ensuredir(path.dirname(targetfn))
|
||||
f = codecs.open(targetfn, 'w', 'latin1')
|
||||
f = codecs.open(targetfn, 'w', 'utf-8')
|
||||
try:
|
||||
text = ''.join(hl(i+1, line) for (i, line) in enumerate(lines))
|
||||
ctx = {
|
||||
|
@ -186,7 +186,7 @@ def inline_all_toctrees(builder, docnameset, docname, tree, colorfunc):
|
||||
tree = tree.deepcopy()
|
||||
for toctreenode in tree.traverse(addnodes.toctree):
|
||||
newnodes = []
|
||||
includefiles = map(str, toctreenode['includefiles'])
|
||||
includefiles = map(unicode, toctreenode['includefiles'])
|
||||
for includefile in includefiles:
|
||||
try:
|
||||
builder.info(colorfunc(includefile) + " ", nonl=1)
|
||||
|
@ -18,16 +18,14 @@ except ImportError:
|
||||
ManWriter = None
|
||||
|
||||
|
||||
builder_names = ['pickle', 'json', 'linkcheck', 'text', 'htmlhelp', 'qthelp',
|
||||
'epub', 'changes', 'singlehtml', 'xml', 'pseudoxml']
|
||||
|
||||
|
||||
def teardown_module():
|
||||
(test_root / '_build').rmtree(True)
|
||||
|
||||
|
||||
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)
|
||||
yield lambda app: app.builder.build_all(), app
|
||||
app.cleanup()
|
||||
@ -41,8 +39,7 @@ def test_man(app):
|
||||
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)
|
||||
mb_name = u'\u65e5\u672c\u8a9e'
|
||||
try:
|
||||
@ -63,6 +60,22 @@ def test_nonascii_path(app):
|
||||
.. toctree::
|
||||
|
||||
%(mb_name)s/%(mb_name)s
|
||||
""" % locals())
|
||||
""" % {'mb_name': mb_name})
|
||||
).encode('utf-8'))
|
||||
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