mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Closes #675: Fix IndexErrors when including nonexisting lines with :rst:dir:literalinclude
.
This commit is contained in:
parent
eaa43cafce
commit
02a3b5bfdf
3
CHANGES
3
CHANGES
@ -1,6 +1,9 @@
|
||||
Release 1.0.8 (in development)
|
||||
==============================
|
||||
|
||||
* #675: Fix IndexErrors when including nonexisting lines with
|
||||
:rst:dir:`literalinclude`.
|
||||
|
||||
* #676: Respect custom function/method parameter separator strings.
|
||||
|
||||
* #682: Fix JS incompatibility with jQuery >= 1.5.
|
||||
|
@ -152,7 +152,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')
|
||||
|
Loading…
Reference in New Issue
Block a user