diff --git a/sphinx/ext/viewcode.py b/sphinx/ext/viewcode.py index 6be03a468..7f9df2da9 100644 --- a/sphinx/ext/viewcode.py +++ b/sphinx/ext/viewcode.py @@ -100,7 +100,8 @@ def collect_pages(app): backlink = urito(pagename, docname) + '#' + modname + '.' + name lines[start] = ( '
%s' % (name, backlink, _('[docs]')) + lines[start]) + 'href="%s">%s' % (name, backlink, _('[docs]')) + + lines[start]) lines[end - 1] += '
' # try to find parents (for submodules) parents = [] @@ -119,14 +120,15 @@ def collect_pages(app): context = { 'parents': parents, 'title': modname, - 'body': _('

Source code for %s

') % modname + '\n'.join(lines) + 'body': _('

Source code for %s

') % modname + \ + '\n'.join(lines) } app.builder.info(' '+pagename, nonl=1) yield (pagename, context, 'page.html') if not modnames: return - + app.builder.info(' _modules/index') html = ['\n'] # the stack logic is needed for using nested lists for submodules