mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix "Title underline is short" WARNING is given when using fullwidth characters to "Project name" on quickstart. Closes #1189
This commit is contained in:
parent
573d8433b9
commit
8ec83f963b
2
CHANGES
2
CHANGES
@ -28,6 +28,8 @@ Bugs fixed
|
|||||||
Thanks to tychoish.
|
Thanks to tychoish.
|
||||||
* #1188: sphinx-quickstart raises UnicodeEncodeError if "Project version"
|
* #1188: sphinx-quickstart raises UnicodeEncodeError if "Project version"
|
||||||
includes non-ASCII characters.
|
includes non-ASCII characters.
|
||||||
|
* #1189: "Title underline is short" WARNING is given when using fullwidth
|
||||||
|
characters to "Project name" on quickstart.
|
||||||
|
|
||||||
|
|
||||||
Release 1.2 (beta1 released Mar 31, 2013)
|
Release 1.2 (beta1 released Mar 31, 2013)
|
||||||
|
@ -14,6 +14,8 @@ from os import path
|
|||||||
|
|
||||||
TERM_ENCODING = getattr(sys.stdin, 'encoding', None)
|
TERM_ENCODING = getattr(sys.stdin, 'encoding', None)
|
||||||
|
|
||||||
|
from docutils.utils import column_width
|
||||||
|
|
||||||
from sphinx import __version__
|
from sphinx import __version__
|
||||||
from sphinx.util.osutil import make_filename
|
from sphinx.util.osutil import make_filename
|
||||||
from sphinx.util.console import purple, bold, red, turquoise, \
|
from sphinx.util.console import purple, bold, red, turquoise, \
|
||||||
@ -1088,7 +1090,7 @@ def generate(d, overwrite=True, silent=False):
|
|||||||
d['project_fn'] = make_filename(d['project'])
|
d['project_fn'] = make_filename(d['project'])
|
||||||
d['project_manpage'] = d['project_fn'].lower()
|
d['project_manpage'] = d['project_fn'].lower()
|
||||||
d['now'] = time.asctime()
|
d['now'] = time.asctime()
|
||||||
d['project_underline'] = len(d['project']) * '='
|
d['project_underline'] = column_width(d['project']) * '='
|
||||||
extensions = (',\n' + indent).join(
|
extensions = (',\n' + indent).join(
|
||||||
repr('sphinx.ext.' + name)
|
repr('sphinx.ext.' + name)
|
||||||
for name in ('autodoc', 'doctest', 'intersphinx', 'todo', 'coverage',
|
for name in ('autodoc', 'doctest', 'intersphinx', 'todo', 'coverage',
|
||||||
|
@ -11,13 +11,20 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
from StringIO import StringIO
|
||||||
|
import tempfile
|
||||||
|
|
||||||
from util import raises, with_tempdir
|
from util import raises, with_tempdir, with_app
|
||||||
|
|
||||||
|
from sphinx import application
|
||||||
from sphinx import quickstart as qs
|
from sphinx import quickstart as qs
|
||||||
from sphinx.util.console import nocolor, coloron
|
from sphinx.util.console import nocolor, coloron
|
||||||
from sphinx.util.pycompat import execfile_
|
from sphinx.util.pycompat import execfile_
|
||||||
|
|
||||||
|
|
||||||
|
warnfile = StringIO()
|
||||||
|
|
||||||
|
|
||||||
def setup_module():
|
def setup_module():
|
||||||
nocolor()
|
nocolor()
|
||||||
|
|
||||||
@ -230,3 +237,29 @@ def test_generated_files_eol(tempdir):
|
|||||||
|
|
||||||
assert_eol(tempdir / 'make.bat', '\r\n')
|
assert_eol(tempdir / 'make.bat', '\r\n')
|
||||||
assert_eol(tempdir / 'Makefile', '\n')
|
assert_eol(tempdir / 'Makefile', '\n')
|
||||||
|
|
||||||
|
|
||||||
|
@with_tempdir
|
||||||
|
def test_quickstart_and_build(tmpdir):
|
||||||
|
answers = {
|
||||||
|
'Root path': tmpdir,
|
||||||
|
'Project name': ur'Fullwidth charactor: \u30c9\u30a4\u30c4',
|
||||||
|
'Author name': 'Georg Brandl',
|
||||||
|
'Project version': '0.1',
|
||||||
|
}
|
||||||
|
qs.term_input = mock_raw_input(answers)
|
||||||
|
d = {}
|
||||||
|
qs.ask_user(d)
|
||||||
|
qs.generate(d)
|
||||||
|
|
||||||
|
app = application.Sphinx(
|
||||||
|
tmpdir, #srcdir
|
||||||
|
tmpdir, #confdir
|
||||||
|
(tmpdir / '_build' / 'html'), #outdir
|
||||||
|
(tmpdir / '_build' / '.doctree'), #doctreedir
|
||||||
|
'html', #buildername
|
||||||
|
status=StringIO(),
|
||||||
|
warning=warnfile)
|
||||||
|
app.builder.build_all()
|
||||||
|
warnings = warnfile.getvalue()
|
||||||
|
assert not warnings
|
||||||
|
Loading…
Reference in New Issue
Block a user