Merge branch '1.7' into 5016_recommonmark_crashed

This commit is contained in:
Takeshi KOMIYA 2018-06-07 01:59:08 +09:00 committed by GitHub
commit 43b725b119
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 16 deletions

View File

@ -16,10 +16,11 @@ Features added
Bugs fixed Bugs fixed
---------- ----------
* #5037: LaTeX ``\sphinxupquote{}`` breaks in Russian
* sphinx.testing uses deprecated pytest API; ``Node.get_marker(name)``
* #5016: ``character_level_inline_markup`` setting is not initialized for * #5016: ``character_level_inline_markup`` setting is not initialized for
combination of non reST source parsers (ex. recommonmark) and docutils-0.13 combination of non reST source parsers (ex. recommonmark) and docutils-0.13
Testing Testing
-------- --------

View File

@ -39,7 +39,10 @@ def app_params(request, test_params, shared_result, sphinx_test_tempdir, rootdir
# ##### process pytest.mark.sphinx # ##### process pytest.mark.sphinx
markers = request.node.get_marker("sphinx") if hasattr(request.node, 'iter_markers'): # pytest-3.6.0 or newer
markers = request.node.iter_markers("sphinx")
else:
markers = request.node.get_marker("sphinx")
pargs = {} pargs = {}
kwargs = {} # type: Dict[str, str] kwargs = {} # type: Dict[str, str]
@ -86,7 +89,10 @@ def test_params(request):
have same 'shared_result' value. have same 'shared_result' value.
**NOTE**: You can not specify shared_result and srcdir in same time. **NOTE**: You can not specify shared_result and srcdir in same time.
""" """
env = request.node.get_marker('test_params') if hasattr(request.node, 'get_closest_marker'): # pytest-3.6.0 or newer
env = request.node.get_closest_marker('test_params')
else:
env = request.node.get_marker('test_params')
kwargs = env.kwargs if env else {} kwargs = env.kwargs if env else {}
result = { result = {
'shared_result': None, 'shared_result': None,

View File

@ -200,15 +200,10 @@ class ExtBabel(Babel):
def get_shorthandoff(self): def get_shorthandoff(self):
# type: () -> unicode # type: () -> unicode
shortlang = self.language.split('_')[0] return ('\\ifdefined\\shorthandoff\n'
if shortlang in ('de', 'ngerman', 'sl', 'slovene', 'pt', 'portuges', ' \\ifnum\\catcode`\\=\\string=\\active\\shorthandoff{=}\\fi\n'
'es', 'spanish', 'nl', 'dutch', 'pl', 'polish', 'it', ' \\ifnum\\catcode`\\"=\\active\\shorthandoff{"}\\fi\n'
'italian', 'pt-BR', 'brazil'): '\\fi')
return '\\ifnum\\catcode`\\"=\\active\\shorthandoff{"}\\fi'
elif shortlang in ('tr', 'turkish'):
# memo: if ever Sphinx starts supporting 'Latin', do as for Turkish
return '\\ifnum\\catcode`\\=\\string=\\active\\shorthandoff{=}\\fi'
return ''
def uses_cyrillic(self): def uses_cyrillic(self):
# type: () -> bool # type: () -> bool
@ -568,6 +563,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.elements['classoptions'] = ',dvipdfmx' self.elements['classoptions'] = ',dvipdfmx'
# disable babel which has not publishing quality in Japanese # disable babel which has not publishing quality in Japanese
self.elements['babel'] = '' self.elements['babel'] = ''
self.elements['shorthandoff'] = ''
self.elements['multilingual'] = '' self.elements['multilingual'] = ''
# disable fncychap in Japanese documents # disable fncychap in Japanese documents
self.elements['fncychap'] = '' self.elements['fncychap'] = ''

View File

@ -467,7 +467,7 @@ def test_babel_with_language_ru(app, status, warning):
assert '\\addto\\captionsrussian{\\renewcommand{\\tablename}{Table.}}\n' in result assert '\\addto\\captionsrussian{\\renewcommand{\\tablename}{Table.}}\n' in result
assert (u'\\addto\\extrasrussian{\\def\\pageautorefname' assert (u'\\addto\\extrasrussian{\\def\\pageautorefname'
u'{\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430}}\n' in result) u'{\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430}}\n' in result)
assert '\\shorthandoff' not in result assert '\\shorthandoff' in result
@pytest.mark.sphinx( @pytest.mark.sphinx(
@ -529,7 +529,7 @@ def test_babel_with_unknown_language(app, status, warning):
assert '\\addto\\captionsenglish{\\renewcommand{\\figurename}{Fig.}}\n' in result assert '\\addto\\captionsenglish{\\renewcommand{\\figurename}{Fig.}}\n' in result
assert '\\addto\\captionsenglish{\\renewcommand{\\tablename}{Table.}}\n' in result assert '\\addto\\captionsenglish{\\renewcommand{\\tablename}{Table.}}\n' in result
assert '\\addto\\extrasenglish{\\def\\pageautorefname{page}}\n' in result assert '\\addto\\extrasenglish{\\def\\pageautorefname{page}}\n' in result
assert '\\shorthandoff' not in result assert '\\shorthandoff' in result
assert "WARNING: no Babel option known for language 'unknown'" in warning.getvalue() assert "WARNING: no Babel option known for language 'unknown'" in warning.getvalue()

View File

@ -32,7 +32,10 @@ def apidoc(rootdir, tempdir, apidoc_params):
@pytest.fixture @pytest.fixture
def apidoc_params(request): def apidoc_params(request):
markers = request.node.get_marker("apidoc") if hasattr(request.node, 'iter_markers'): # pytest-3.6.0 or newer
markers = request.node.iter_markers("apidoc")
else:
markers = request.node.get_marker("apidoc")
pargs = {} pargs = {}
kwargs = {} kwargs = {}

View File

@ -27,7 +27,10 @@ def setup_command(request, tempdir, rootdir):
Run `setup.py build_sphinx` with args and kwargs, Run `setup.py build_sphinx` with args and kwargs,
pass it to the test and clean up properly. pass it to the test and clean up properly.
""" """
marker = request.node.get_marker('setup_command') if hasattr(request.node, 'get_closest_marker'): # pytest-3.6.0 or newer
marker = request.node.get_closest_marker('setup_command')
else:
marker = request.node.get_marker('setup_command')
args = marker.args if marker else [] args = marker.args if marker else []
pkgrootdir = tempdir / 'test-setup' pkgrootdir = tempdir / 'test-setup'