diff options
| author | Georg Brandl <georg@python.org> | 2010-05-26 19:32:17 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2010-05-26 19:32:17 +0200 |
| commit | 7e7593c4dd2ba4f34c0787bfb2bc35ce94ced7a7 (patch) | |
| tree | 54ed1dd958448f962e91e39bc37dd32434b296ea /sphinx/ext/viewcode.py | |
| parent | d3d93a54f0c8eab661e4ff43450fb5b04ffb1f05 (diff) | |
| download | sphinx-git-7e7593c4dd2ba4f34c0787bfb2bc35ce94ced7a7.tar.gz | |
#424: Fix IndexError in viewcode extension.
Diffstat (limited to 'sphinx/ext/viewcode.py')
| -rw-r--r-- | sphinx/ext/viewcode.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sphinx/ext/viewcode.py b/sphinx/ext/viewcode.py index d8b649da9..d79df22e0 100644 --- a/sphinx/ext/viewcode.py +++ b/sphinx/ext/viewcode.py @@ -104,6 +104,7 @@ def collect_pages(app): # now that we have code lines (starting at index 1), insert anchors for # the collected tags (HACK: this only works if the tag boundaries are # properly nested!) + maxindex = len(lines) for name, docname in used.iteritems(): type, start, end = tags[name] backlink = urito(pagename, docname) + '#' + modname + '.' + name @@ -111,7 +112,7 @@ def collect_pages(app): '<div class="viewcode-block" id="%s"><a class="viewcode-back" ' 'href="%s">%s</a>' % (name, backlink, _('[docs]')) + lines[start]) - lines[end - 1] += '</div>' + lines[min(end - 1, maxindex)] += '</div>' # try to find parents (for submodules) parents = [] parent = modname |
