Merge branch '1.7'

This commit is contained in:
jfbu 2018-06-05 18:17:18 +02:00
commit f9e2a41a48
2 changed files with 7 additions and 9 deletions

View File

@ -219,13 +219,10 @@ class ExtBabel(Babel):
def get_shorthandoff(self): def get_shorthandoff(self):
# type: () -> unicode # type: () -> unicode
shorthand = self.shorthands.get(self.language) return ('\\ifdefined\\shorthandoff\n'
if shorthand: ' \\ifnum\\catcode`\\=\\string=\\active\\shorthandoff{=}\\fi\n'
return r'\ifnum\catcode`\%s=\active\shorthandoff{%s}\fi' % (shorthand, shorthand) ' \\ifnum\\catcode`\\"=\\active\\shorthandoff{"}\\fi\n'
elif self.language == 'turkish': '\\fi')
# memo: if ever Sphinx starts supporting 'Latin', do as for Turkish
return r'\ifnum\catcode`\=\string=\active\shorthandoff{=}\fi'
return ''
def uses_cyrillic(self): def uses_cyrillic(self):
# type: () -> bool # type: () -> bool
@ -595,6 +592,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()