mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #8721 from tk0miya/8720_viewcode_incremental_build
Fix #8720: viewcode: module pages are generated for epub on incremental build
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -68,6 +68,7 @@ Bugs fixed
|
|||||||
availability of the same URL twice
|
availability of the same URL twice
|
||||||
* #8094: texinfo: image files on the different directory with document are not
|
* #8094: texinfo: image files on the different directory with document are not
|
||||||
copied
|
copied
|
||||||
|
* #8720: viewcode: module pages are generated for epub on incremental build
|
||||||
* #8671: :confval:`highlight_options` is not working
|
* #8671: :confval:`highlight_options` is not working
|
||||||
* #8341: C, fix intersphinx lookup types for names in declarations.
|
* #8341: C, fix intersphinx lookup types for names in declarations.
|
||||||
* C, C++: in general fix intersphinx and role lookup types.
|
* C, C++: in general fix intersphinx and role lookup types.
|
||||||
|
|||||||
@@ -182,6 +182,10 @@ def collect_pages(app: Sphinx) -> Generator[Tuple[str, Dict[str, Any], str], Non
|
|||||||
env = app.builder.env
|
env = app.builder.env
|
||||||
if not hasattr(env, '_viewcode_modules'):
|
if not hasattr(env, '_viewcode_modules'):
|
||||||
return
|
return
|
||||||
|
if app.builder.name == "singlehtml":
|
||||||
|
return
|
||||||
|
if app.builder.name.startswith("epub") and not env.config.viewcode_enable_epub:
|
||||||
|
return
|
||||||
highlighter = app.builder.highlighter # type: ignore
|
highlighter = app.builder.highlighter # type: ignore
|
||||||
urito = app.builder.get_relative_uri
|
urito = app.builder.get_relative_uri
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,21 @@ def test_viewcode(app, status, warning):
|
|||||||
'<span> """</span></div>\n') in result
|
'<span> """</span></div>\n') in result
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('epub', testroot='ext-viewcode')
|
||||||
|
def test_viewcode_epub_default(app, status, warning):
|
||||||
|
app.builder.build_all()
|
||||||
|
|
||||||
|
assert not (app.outdir / '_modules/spam/mod1.xhtml').exists()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('epub', testroot='ext-viewcode',
|
||||||
|
confoverrides={'viewcode_enable_epub': True})
|
||||||
|
def test_viewcode_epub_enabled(app, status, warning):
|
||||||
|
app.builder.build_all()
|
||||||
|
|
||||||
|
assert (app.outdir / '_modules/spam/mod1.xhtml').exists()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx(testroot='ext-viewcode', tags=['test_linkcode'])
|
@pytest.mark.sphinx(testroot='ext-viewcode', tags=['test_linkcode'])
|
||||||
def test_linkcode(app, status, warning):
|
def test_linkcode(app, status, warning):
|
||||||
app.builder.build(['objects'])
|
app.builder.build(['objects'])
|
||||||
|
|||||||
Reference in New Issue
Block a user