mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #8704: viewcode: anchors are generated in incremental build
The anchors for viewcode was generated in the reading phase only if supported builder is used. It causes anchors are missing on the incremental build after the build for non supported builder. This introduces `viewcode_anchor` node to insert the anchor even if non supported builders. They will be converted to the anchor tag in the resolving phase for supported builders. Or, they will be removed for non supported builders.
This commit is contained in:
@@ -55,6 +55,9 @@ def test_viewcode_epub_default(app, status, warning):
|
||||
|
||||
assert not (app.outdir / '_modules/spam/mod1.xhtml').exists()
|
||||
|
||||
result = (app.outdir / 'index.xhtml').read_text()
|
||||
assert result.count('href="_modules/spam/mod1.xhtml#func1"') == 0
|
||||
|
||||
|
||||
@pytest.mark.sphinx('epub', testroot='ext-viewcode',
|
||||
confoverrides={'viewcode_enable_epub': True})
|
||||
@@ -63,6 +66,9 @@ def test_viewcode_epub_enabled(app, status, warning):
|
||||
|
||||
assert (app.outdir / '_modules/spam/mod1.xhtml').exists()
|
||||
|
||||
result = (app.outdir / 'index.xhtml').read_text()
|
||||
assert result.count('href="_modules/spam/mod1.xhtml#func1"') == 2
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='ext-viewcode', tags=['test_linkcode'])
|
||||
def test_linkcode(app, status, warning):
|
||||
|
||||
Reference in New Issue
Block a user