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 | 35de961316c0515828760457134b95ee61b9eb0a (patch) | |
| tree | 54ed1dd958448f962e91e39bc37dd32434b296ea /sphinx/ext/viewcode.py | |
| parent | 3dfc4e70d431f364f4590f90c841b3d14b9b3d72 (diff) | |
| download | sphinx-35de961316c0515828760457134b95ee61b9eb0a.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 d8b649da..d79df22e 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 |
