LaTeX: deprecate optional argument scre to visit_index()

And it is already ignored.
This commit is contained in:
jfbu 2018-11-04 21:48:35 +01:00
parent 0f45cf75b3
commit 00a75b2742

View File

@ -169,6 +169,8 @@ ADDITIONAL_SETTINGS = {
}, },
} # type: Dict[unicode, Dict[unicode, unicode]] } # type: Dict[unicode, Dict[unicode, unicode]]
EXTRA_RE = re.compile(r'^(.*\S)\s+\(([^()]*)\)\s*$')
class collected_footnote(nodes.footnote): class collected_footnote(nodes.footnote):
"""Footnotes that are collected are assigned this class.""" """Footnotes that are collected are assigned this class."""
@ -1884,8 +1886,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
# type: (nodes.Node) -> None # type: (nodes.Node) -> None
self.body.append('\n\\end{flushright}\n') self.body.append('\n\\end{flushright}\n')
def visit_index(self, node, extrare=re.compile(r'^(.*\S)\s+\(([^()]*)\)\s*$')): def visit_index(self, node, scre = None):
# type: (nodes.Node, Pattern) -> None # type: (nodes.Node, None) -> None
def escape(value): def escape(value):
value = self.encode(value) value = self.encode(value)
value = value.replace(r'\{', r'\sphinxleftcurlybrace{}') value = value.replace(r'\{', r'\sphinxleftcurlybrace{}')
@ -1896,12 +1898,16 @@ class LaTeXTranslator(nodes.NodeVisitor):
return value return value
def style(string): def style(string):
match = extrare.match(string) match = EXTRA_RE.match(string)
if match: if match:
return match.expand(r'\\spxentry{\1}\\spxextra{\2}') return match.expand(r'\\spxentry{\1}\\spxextra{\2}')
else: else:
return '\\spxentry{%s}' % string return '\\spxentry{%s}' % string
if scre:
warnings.warn(('LaTeXTranslator.visit_index() optional argument '
'"scre" is deprecated. It is ignored.'),
RemovedInSphinx30Warning, stacklevel=2)
if not node.get('inline', True): if not node.get('inline', True):
self.body.append('\n') self.body.append('\n')
entries = node['entries'] entries = node['entries']