diff options
| author | Georg Brandl <georg@python.org> | 2011-05-15 13:52:48 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2011-05-15 13:52:48 +0200 |
| commit | fd2c55eaea41cfb0db941c7d0538215306f1da9a (patch) | |
| tree | e930a63eeab723b56cb4a281cf219602010299df /sphinx/directives | |
| parent | 88a4dce9a45b76d990e2768de69eb465a5f216f7 (diff) | |
| parent | ba9d023acf4361093666eaf1aa6e78b0ab41a891 (diff) | |
| download | sphinx-fd2c55eaea41cfb0db941c7d0538215306f1da9a.tar.gz | |
merge with 1.0
Diffstat (limited to 'sphinx/directives')
| -rw-r--r-- | sphinx/directives/code.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py index 99fb3502..8cedab19 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -138,7 +138,13 @@ class LiteralInclude(Directive): linelist = parselinenos(linespec, len(lines)) except ValueError, err: return [document.reporter.warning(str(err), line=self.lineno)] - lines = [lines[i] for i in linelist] + # just ignore nonexisting lines + nlines = len(lines) + lines = [lines[i] for i in linelist if i < nlines] + if not lines: + return [document.reporter.warning( + 'Line spec %r: no lines pulled from include file %r' % + (linespec, filename), line=self.lineno)] startafter = self.options.get('start-after') endbefore = self.options.get('end-before') |
