harbor run -t openthoughts/tasktrove-exp-rpt-issue-issue-1789harbor download openthoughts/tasktrove-exp-rpt-issue-issue-1789Description
make html epub) even when the configuration viewcode_enable_epub is set to False.viewcode_enable_epub is False, no viewcode pages should be created. (The patch also adds a safeguard to skip for singlehtml builds.)What to modify
/app/sphinx/ext/viewcode.pysinglehtml, skip collecting viewcode pages.epub and env.config.viewcode_enable_epub is False, skip collecting viewcode pages.Before state (pre-fix)
# before: portion of sphinx/ext/viewcode.py
from typing import Any, Dict, Generator, Tuple
def collect_pages(app: "Sphinx") -> Generator[Tuple[str, Dict[str, Any], str], None, None]:
env = app.builder.env
if not hasattr(env, '_viewcode_modules'):
return
highlighter = app.builder.highlighter # type: ignore
urito = app.builder.get_relative_uri
# ... rest of the function that collects and yields viewcode pages ...
What you will implement (high-level description)
app.builder.name == "singlehtml", return without collecting pages.app.builder.name.startswith("epub") and not env.config.viewcode_enable_epub, return without collecting pages.How to test (manual steps)
make epub (or make html epub for combined output)viewcode_enable_epub is False.make html epubviewcode_enable_epub is False.make html (non-epub) to ensure viewcode pages are still generated as usual when allowed.viewcode_enable_epub = True and run make epub to confirm EPUB viewcode pages are generated when enabled.Notes