diff options
Diffstat (limited to 'sphinx/ext/viewcode.py')
-rw-r--r-- | sphinx/ext/viewcode.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sphinx/ext/viewcode.py b/sphinx/ext/viewcode.py index 5bde12d6c..183c18406 100644 --- a/sphinx/ext/viewcode.py +++ b/sphinx/ext/viewcode.py @@ -307,10 +307,9 @@ def collect_pages(app: Sphinx) -> Generator[tuple[str, dict[str, Any], str], Non stack.pop() html.append('</ul>') stack.append(modname + '.') - html.append('<li><a href="%s">%s</a></li>\n' % ( - urito(posixpath.join(OUTPUT_DIRNAME, 'index'), - posixpath.join(OUTPUT_DIRNAME, modname.replace('.', '/'))), - modname)) + relative_uri = urito(posixpath.join(OUTPUT_DIRNAME, 'index'), + posixpath.join(OUTPUT_DIRNAME, modname.replace('.', '/'))) + html.append(f'<li><a href="{relative_uri}">{modname}</a></li>\n') html.append('</ul>' * (len(stack) - 1)) context = { 'title': _('Overview: module code'), |