mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix broken numeric reference in PDF hyperlinks to "Listing " code-blocks
The `\label` is now inserted into the caption on top of the Verbatim, and `\ref` will work as expected. No need for `\phantomsection`. modified: sphinx/writers/latex.py modified: tests/test_directive_code.py
This commit is contained in:
@@ -64,7 +64,7 @@ def test_code_block_caption_html(app, status, warning):
|
||||
def test_code_block_caption_latex(app, status, warning):
|
||||
app.builder.build_all()
|
||||
latex = (app.outdir / 'Python.tex').text(encoding='utf-8')
|
||||
caption = '\\SphinxSetupCaptionForVerbatim{literal-block}{caption \\emph{test} rb}'
|
||||
caption = '\\SphinxSetupCaptionForVerbatim{literal-block}{\label{caption:caption-test-rb}caption \\emph{test} rb}'
|
||||
assert caption in latex
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ def test_literalinclude_caption_html(app, status, warning):
|
||||
def test_literalinclude_caption_latex(app, status, warning):
|
||||
app.builder.build('index')
|
||||
latex = (app.outdir / 'Python.tex').text(encoding='utf-8')
|
||||
caption = '\\SphinxSetupCaptionForVerbatim{literal-block}{caption \\textbf{test} py}'
|
||||
caption = '\\SphinxSetupCaptionForVerbatim{literal-block}{\label{caption:caption-test-py}caption \\textbf{test} py}'
|
||||
assert caption in latex
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user