mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #6845 from jfbu/latex_do_not_escape_verticalbarchar
LaTeX: stop escaping | to LaTeX macro, except if in an index entry
This commit is contained in:
commit
9f7c7a34db
@ -35,8 +35,6 @@ tex_replacements = [
|
|||||||
('`', r'{}`'),
|
('`', r'{}`'),
|
||||||
('<', r'\textless{}'),
|
('<', r'\textless{}'),
|
||||||
('>', r'\textgreater{}'),
|
('>', r'\textgreater{}'),
|
||||||
# map char for some unknown reason. TODO: remove this?
|
|
||||||
('|', r'\textbar{}'),
|
|
||||||
# map special Unicode characters to TeX commands
|
# map special Unicode characters to TeX commands
|
||||||
('✓', r'\(\checkmark\)'),
|
('✓', r'\(\checkmark\)'),
|
||||||
('✔', r'\(\pmb{\checkmark}\)'),
|
('✔', r'\(\pmb{\checkmark}\)'),
|
||||||
|
@ -1816,6 +1816,7 @@ class LaTeXTranslator(SphinxTranslator):
|
|||||||
value = value.replace('"', '""')
|
value = value.replace('"', '""')
|
||||||
value = value.replace('@', '"@')
|
value = value.replace('@', '"@')
|
||||||
value = value.replace('!', '"!')
|
value = value.replace('!', '"!')
|
||||||
|
value = value.replace('|', r'\textbar{}')
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def style(string):
|
def style(string):
|
||||||
|
@ -315,7 +315,7 @@ def test_numref_with_prefix2(app, status, warning):
|
|||||||
assert ('\\hyperref[\\detokenize{baz:table22}]'
|
assert ('\\hyperref[\\detokenize{baz:table22}]'
|
||||||
'{Table:\\ref{\\detokenize{baz:table22}}}') in result
|
'{Table:\\ref{\\detokenize{baz:table22}}}') in result
|
||||||
assert ('\\hyperref[\\detokenize{index:code-1}]{Code-\\ref{\\detokenize{index:code-1}} '
|
assert ('\\hyperref[\\detokenize{index:code-1}]{Code-\\ref{\\detokenize{index:code-1}} '
|
||||||
'\\textbar{} }') in result
|
'| }') in result
|
||||||
assert ('\\hyperref[\\detokenize{baz:code22}]'
|
assert ('\\hyperref[\\detokenize{baz:code22}]'
|
||||||
'{Code-\\ref{\\detokenize{baz:code22}}}') in result
|
'{Code-\\ref{\\detokenize{baz:code22}}}') in result
|
||||||
assert ('\\hyperref[\\detokenize{foo:foo}]'
|
assert ('\\hyperref[\\detokenize{foo:foo}]'
|
||||||
|
Loading…
Reference in New Issue
Block a user