summaryrefslogtreecommitdiff
path: root/sphinx/ext/viewcode.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-22 00:33:39 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-22 00:51:21 +0900
commitb2bb12ad9193ce0c0047ae7bf3cde9ea10f46d8a (patch)
tree01a757e1a9df9659700f5dc0698efdea8a55e130 /sphinx/ext/viewcode.py
parent82ef497a8c88f0f6e50d84520e7276bfbf65025d (diff)
downloadsphinx-git-b2bb12ad9193ce0c0047ae7bf3cde9ea10f46d8a.tar.gz
Fix #8720: viewcode: module pages are generated for epub on incremental build
The module pages should be generated for epub only if enabled via configuration. But they are generated after the build for other viewcode-supported builders. This checks the current builder on generating module pages.
Diffstat (limited to 'sphinx/ext/viewcode.py')
-rw-r--r--sphinx/ext/viewcode.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/sphinx/ext/viewcode.py b/sphinx/ext/viewcode.py
index a7d52a91c..c2bcee4f5 100644
--- a/sphinx/ext/viewcode.py
+++ b/sphinx/ext/viewcode.py
@@ -182,6 +182,10 @@ def collect_pages(app: Sphinx) -> Generator[Tuple[str, Dict[str, Any], str], Non
env = app.builder.env
if not hasattr(env, '_viewcode_modules'):
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
urito = app.builder.get_relative_uri