mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
fix latex issue with references from inside parsed-literal (ref #3207)
This commit is contained in:
parent
b1abd4629b
commit
e25cce1a64
@ -2117,7 +2117,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
self.body.append(r'\sphinxaccelerator{')
|
||||
self.context.append('}')
|
||||
elif classes and not self.in_title:
|
||||
self.body.append(r'\DUrole{%s}{' % ','.join(classes))
|
||||
self.body.append(r'\DUrole{\detokenize{%s}}{' % ','.join(classes))
|
||||
self.context.append('}')
|
||||
else:
|
||||
self.context.append('')
|
||||
|
@ -461,8 +461,8 @@ def test_reference_in_caption_and_codeblock_in_footnote(app, status, warning):
|
||||
'\sphinxAtStartFootnote\n'
|
||||
'Foot note in longtable\n%\n\\end{footnotetext}' in result)
|
||||
assert ('This is a reference to the code-block in the footnote:\n'
|
||||
'{\hyperref[index:codeblockinfootnote]{\\sphinxcrossref{\\DUrole'
|
||||
'{std,std-ref}{I am in a footnote}}}}') in result
|
||||
'{\\hyperref[index:codeblockinfootnote]{\\sphinxcrossref{\\DUrole'
|
||||
'{\\detokenize{std,std-ref}}{I am in a footnote}}}}') in result
|
||||
assert ('&\nThis is one more footnote with some code in it '
|
||||
'\\sphinxfootnotemark[10].\n\\\\') in result
|
||||
assert '\\begin{sphinxVerbatim}[commandchars=\\\\\\{\\}]' in result
|
||||
|
@ -80,10 +80,10 @@ def test_code_block_namedlink_latex(app, status, warning):
|
||||
latex = (app.outdir / 'Python.tex').text(encoding='utf-8')
|
||||
label1 = '\def\sphinxLiteralBlockLabel{\label{caption:name-test-rb}}'
|
||||
link1 = '\\hyperref[caption:name\\string-test\\string-rb]'\
|
||||
'{\\sphinxcrossref{\\DUrole{std,std-ref}{Ruby}}'
|
||||
'{\\sphinxcrossref{\\DUrole{\\detokenize{std,std-ref}}{Ruby}}'
|
||||
label2 = '\def\sphinxLiteralBlockLabel{\label{namedblocks:some-ruby-code}}'
|
||||
link2 = '\\hyperref[namedblocks:some\\string-ruby\\string-code]'\
|
||||
'{\\sphinxcrossref{\\DUrole{std,std-ref}{the ruby code}}}'
|
||||
'{\\sphinxcrossref{\\DUrole{\\detokenize{std,std-ref}}{the ruby code}}}'
|
||||
assert label1 in latex
|
||||
assert link1 in latex
|
||||
assert label2 in latex
|
||||
@ -275,10 +275,10 @@ def test_literalinclude_namedlink_latex(app, status, warning):
|
||||
latex = (app.outdir / 'Python.tex').text(encoding='utf-8')
|
||||
label1 = '\def\sphinxLiteralBlockLabel{\label{caption:name-test-py}}'
|
||||
link1 = '\\hyperref[caption:name\\string-test\\string-py]'\
|
||||
'{\\sphinxcrossref{\\DUrole{std,std-ref}{Python}}'
|
||||
'{\\sphinxcrossref{\\DUrole{\\detokenize{std,std-ref}}{Python}}'
|
||||
label2 = '\def\sphinxLiteralBlockLabel{\label{namedblocks:some-python-code}}'
|
||||
link2 = '\\hyperref[namedblocks:some\\string-python\\string-code]'\
|
||||
'{\\sphinxcrossref{\\DUrole{std,std-ref}{the python code}}}'
|
||||
'{\\sphinxcrossref{\\DUrole{\\detokenize{std,std-ref}}{the python code}}}'
|
||||
assert label1 in latex
|
||||
assert link1 in latex
|
||||
assert label2 in latex
|
||||
|
Loading…
Reference in New Issue
Block a user