mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #5095 from tk0miya/5091_latex_curlybrace_in_index
Fix #5091: latex: curly braces in index entries are not handled correctly
This commit is contained in:
commit
fb7267aafe
1
CHANGES
1
CHANGES
@ -30,6 +30,7 @@ Bugs fixed
|
||||
* #5032: autodoc: loses the first staticmethod parameter for old styled classes
|
||||
* #5036: quickstart: Typing Ctrl-U clears the whole of line
|
||||
* #5066: html: "relations" sidebar is not shown by default
|
||||
* #5091: latex: curly braces in index entries are not handled correctly
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -1953,8 +1953,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
# type: (nodes.Node, Pattern) -> None
|
||||
def escape(value):
|
||||
value = self.encode(value)
|
||||
value = value.replace(r'\{', r'\sphinxleftcurlybrace')
|
||||
value = value.replace(r'\}', r'\sphinxrightcurlybrace')
|
||||
value = value.replace(r'\{', r'{\sphinxleftcurlybrace}')
|
||||
value = value.replace(r'\}', r'{\sphinxrightcurlybrace}')
|
||||
return value
|
||||
|
||||
if not node.get('inline', True):
|
||||
|
@ -1209,7 +1209,7 @@ def test_latex_index(app, status, warning):
|
||||
result = (app.outdir / 'Python.tex').text(encoding='utf8')
|
||||
assert 'A \\index{famous}famous \\index{equation}equation:\n' in result
|
||||
assert '\n\\index{Einstein}\\index{relativity}\\ignorespaces \nand' in result
|
||||
assert '\n\\index{main \\sphinxleftcurlybrace}\\ignorespaces ' in result
|
||||
assert '\n\\index{main {\\sphinxleftcurlybrace}}\\ignorespaces ' in result
|
||||
|
||||
|
||||
@pytest.mark.sphinx('latex', testroot='latex-equations')
|
||||
|
Loading…
Reference in New Issue
Block a user