mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Remove usage of internal shorthandoff variable from LaTeX writer
This commit is contained in:
parent
f9e2a41a48
commit
a32c358342
@ -2114,7 +2114,6 @@ information.
|
||||
``'author'``
|
||||
``'logo'``
|
||||
``'makeindex'``
|
||||
``'shorthandoff'``
|
||||
|
||||
.. confval:: latex_docclass
|
||||
|
||||
|
@ -44,7 +44,10 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
BEGIN_DOC = r'''
|
||||
\begin{document}
|
||||
%(shorthandoff)s
|
||||
\ifdefined\shorthandoff
|
||||
\ifnum\catcode`\=\string=\active\shorthandoff{=}\fi
|
||||
\ifnum\catcode`\"=\active\shorthandoff{"}\fi
|
||||
\fi
|
||||
%(maketitle)s
|
||||
%(tableofcontents)s
|
||||
'''
|
||||
@ -101,7 +104,6 @@ DEFAULT_SETTINGS = {
|
||||
'logo': '\\vbox{}',
|
||||
'releasename': '',
|
||||
'makeindex': '\\makeindex',
|
||||
'shorthandoff': '',
|
||||
'maketitle': '\\maketitle',
|
||||
'tableofcontents': '\\sphinxtableofcontents',
|
||||
'atendofbody': '',
|
||||
@ -217,13 +219,6 @@ class ExtBabel(Babel):
|
||||
self.supported = True
|
||||
super(ExtBabel, self).__init__(language_code or '')
|
||||
|
||||
def get_shorthandoff(self):
|
||||
# type: () -> unicode
|
||||
return ('\\ifdefined\\shorthandoff\n'
|
||||
' \\ifnum\\catcode`\\=\\string=\\active\\shorthandoff{=}\\fi\n'
|
||||
' \\ifnum\\catcode`\\"=\\active\\shorthandoff{"}\\fi\n'
|
||||
'\\fi')
|
||||
|
||||
def uses_cyrillic(self):
|
||||
# type: () -> bool
|
||||
return self.language in self.cyrillic_languages
|
||||
@ -579,7 +574,6 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
# this branch is not taken for xelatex/lualatex if default settings
|
||||
self.elements['multilingual'] = self.elements['babel']
|
||||
if builder.config.language:
|
||||
self.elements['shorthandoff'] = self.babel.get_shorthandoff()
|
||||
|
||||
# Times fonts don't work with Cyrillic languages
|
||||
if self.babel.uses_cyrillic() \
|
||||
@ -592,7 +586,6 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
self.elements['classoptions'] = ',dvipdfmx'
|
||||
# disable babel which has not publishing quality in Japanese
|
||||
self.elements['babel'] = ''
|
||||
self.elements['shorthandoff'] = ''
|
||||
self.elements['multilingual'] = ''
|
||||
# disable fncychap in Japanese documents
|
||||
self.elements['fncychap'] = ''
|
||||
|
@ -424,7 +424,6 @@ def test_babel_with_no_language_settings(app, status, warning):
|
||||
assert '\\addto\\captionsenglish{\\renewcommand{\\figurename}{Fig.}}\n' in result
|
||||
assert '\\addto\\captionsenglish{\\renewcommand{\\tablename}{Table.}}\n' in result
|
||||
assert '\\addto\\extrasenglish{\\def\\pageautorefname{page}}\n' in result
|
||||
assert '\\shorthandoff' not in result
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
@ -445,7 +444,6 @@ def test_babel_with_language_de(app, status, warning):
|
||||
assert '\\addto\\captionsngerman{\\renewcommand{\\figurename}{Fig.}}\n' in result
|
||||
assert '\\addto\\captionsngerman{\\renewcommand{\\tablename}{Table.}}\n' in result
|
||||
assert '\\addto\\extrasngerman{\\def\\pageautorefname{Seite}}\n' in result
|
||||
assert '\\shorthandoff{"}' in result
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
@ -467,7 +465,6 @@ def test_babel_with_language_ru(app, status, warning):
|
||||
assert '\\addto\\captionsrussian{\\renewcommand{\\tablename}{Table.}}\n' in result
|
||||
assert (u'\\addto\\extrasrussian{\\def\\pageautorefname'
|
||||
u'{\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430}}\n' in result)
|
||||
assert '\\shorthandoff' in result
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
@ -488,7 +485,6 @@ def test_babel_with_language_tr(app, status, warning):
|
||||
assert '\\addto\\captionsturkish{\\renewcommand{\\figurename}{Fig.}}\n' in result
|
||||
assert '\\addto\\captionsturkish{\\renewcommand{\\tablename}{Table.}}\n' in result
|
||||
assert '\\addto\\extrasturkish{\\def\\pageautorefname{sayfa}}\n' in result
|
||||
assert '\\shorthandoff{=}' in result
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
@ -508,7 +504,6 @@ def test_babel_with_language_ja(app, status, warning):
|
||||
assert '\\renewcommand{\\figurename}{Fig.}\n' in result
|
||||
assert '\\renewcommand{\\tablename}{Table.}\n' in result
|
||||
assert u'\\def\\pageautorefname{ページ}\n' in result
|
||||
assert '\\shorthandoff' not in result
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
@ -529,7 +524,6 @@ def test_babel_with_unknown_language(app, status, warning):
|
||||
assert '\\addto\\captionsenglish{\\renewcommand{\\figurename}{Fig.}}\n' in result
|
||||
assert '\\addto\\captionsenglish{\\renewcommand{\\tablename}{Table.}}\n' in result
|
||||
assert '\\addto\\extrasenglish{\\def\\pageautorefname{page}}\n' in result
|
||||
assert '\\shorthandoff' in result
|
||||
|
||||
assert "WARNING: no Babel option known for language 'unknown'" in warning.getvalue()
|
||||
|
||||
@ -553,7 +547,6 @@ def test_polyglossia_with_language_de(app, status, warning):
|
||||
assert '\\addto\\captionsgerman{\\renewcommand{\\figurename}{Fig.}}\n' in result
|
||||
assert '\\addto\\captionsgerman{\\renewcommand{\\tablename}{Table.}}\n' in result
|
||||
assert '\\def\\pageautorefname{Seite}\n' in result
|
||||
assert '\\shorthandoff' not in result
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
@ -575,7 +568,6 @@ def test_polyglossia_with_language_de_1901(app, status, warning):
|
||||
assert '\\addto\\captionsgerman{\\renewcommand{\\figurename}{Fig.}}\n' in result
|
||||
assert '\\addto\\captionsgerman{\\renewcommand{\\tablename}{Table.}}\n' in result
|
||||
assert '\\def\\pageautorefname{page}\n' in result
|
||||
assert '\\shorthandoff' not in result
|
||||
|
||||
|
||||
@pytest.mark.sphinx('latex')
|
||||
|
Loading…
Reference in New Issue
Block a user