mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #5045 from jfbu/latex_remove_shorthandoff_variable
Remove usage of internal shorthandoff variable from LaTeX writer
This commit is contained in:
commit
aedd79c7e4
1
CHANGES
1
CHANGES
@ -82,6 +82,7 @@ Deprecated
|
||||
* ``sphinx.writers.latex.LaTeXTranslator.push_hyperlink_ids()`` is deprecated
|
||||
* ``sphinx.writers.latex.LaTeXTranslator.pop_hyperlink_ids()`` is deprecated
|
||||
* ``sphinx.writers.latex.LaTeXTranslator.bibitems`` is deprecated
|
||||
* ``sphinx.writers.latex.ExtBabel.get_shorthandoff()`` is deprecated
|
||||
* ``sphinx.ext.mathbase.math`` node is deprecated
|
||||
* ``sphinx.ext.mathbase.displaymath`` node is deprecated
|
||||
* ``sphinx.ext.mathbase.eqref`` node is deprecated
|
||||
|
@ -216,6 +216,11 @@ The following is a list of deprecated interface.
|
||||
- 3.0
|
||||
- N/A
|
||||
|
||||
* - ``sphinx.writers.latex.ExtBabel.get_shorthandoff()``
|
||||
- 1.8
|
||||
- 3.0
|
||||
- N/A
|
||||
|
||||
* - ``sphinx.application.CONFIG_FILENAME``
|
||||
- 1.8
|
||||
- 3.0
|
||||
|
@ -2119,7 +2119,6 @@ information.
|
||||
``'author'``
|
||||
``'logo'``
|
||||
``'makeindex'``
|
||||
``'shorthandoff'``
|
||||
|
||||
.. confval:: latex_docclass
|
||||
|
||||
|
@ -49,6 +49,12 @@ BEGIN_DOC = r'''
|
||||
%(tableofcontents)s
|
||||
'''
|
||||
|
||||
SHORTHANDOFF = r'''
|
||||
\ifdefined\shorthandoff
|
||||
\ifnum\catcode`\=\string=\active\shorthandoff{=}\fi
|
||||
\ifnum\catcode`\"=\active\shorthandoff{"}\fi
|
||||
\fi
|
||||
'''
|
||||
|
||||
MAX_CITATION_LABEL_LENGTH = 8
|
||||
LATEXSECTIONNAMES = ["part", "chapter", "section", "subsection",
|
||||
@ -199,16 +205,6 @@ class LaTeXWriter(writers.Writer):
|
||||
|
||||
class ExtBabel(Babel):
|
||||
cyrillic_languages = ('bulgarian', 'kazakh', 'mongolian', 'russian', 'ukrainian')
|
||||
shorthands = {
|
||||
'ngerman': '"',
|
||||
'slovene': '"',
|
||||
'portuges': '"',
|
||||
'brazil': '"',
|
||||
'spanish': '"',
|
||||
'dutch': '"',
|
||||
'polish': '"',
|
||||
'italian': '"',
|
||||
}
|
||||
|
||||
def __init__(self, language_code, use_polyglossia=False):
|
||||
# type: (unicode, bool) -> None
|
||||
@ -219,10 +215,9 @@ class ExtBabel(Babel):
|
||||
|
||||
def get_shorthandoff(self):
|
||||
# type: () -> unicode
|
||||
return ('\\ifdefined\\shorthandoff\n'
|
||||
' \\ifnum\\catcode`\\=\\string=\\active\\shorthandoff{=}\\fi\n'
|
||||
' \\ifnum\\catcode`\\"=\\active\\shorthandoff{"}\\fi\n'
|
||||
'\\fi')
|
||||
warnings.warn('ExtBabel.get_shorthandoff() is deprecated.',
|
||||
RemovedInSphinx30Warning)
|
||||
return SHORTHANDOFF
|
||||
|
||||
def uses_cyrillic(self):
|
||||
# type: () -> bool
|
||||
@ -579,7 +574,7 @@ 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()
|
||||
self.elements['shorthandoff'] = SHORTHANDOFF
|
||||
|
||||
# Times fonts don't work with Cyrillic languages
|
||||
if self.babel.uses_cyrillic() \
|
||||
|
@ -467,7 +467,7 @@ 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
|
||||
assert '\\shorthandoff{"}' in result
|
||||
|
||||
|
||||
@pytest.mark.sphinx(
|
||||
|
Loading…
Reference in New Issue
Block a user