summaryrefslogtreecommitdiff
path: root/sphinx/directives/code.py
diff options
context:
space:
mode:
authorJeppe Pihl <jpihl08@gmail.com>2014-10-06 10:58:03 +0200
committerJeppe Pihl <jpihl08@gmail.com>2014-10-06 10:58:03 +0200
commit0b0cf82a7592060eeee229505eae15003265200a (patch)
tree2dc1693a97dd9d93332ff8434f7bfd81dbda22dc /sphinx/directives/code.py
parenta3745cfb5e07001f8aaf11cf9f7334304f29bd62 (diff)
downloadsphinx-git-0b0cf82a7592060eeee229505eae15003265200a.tar.gz
fixed bugs, and extended unit test to catch them again if they reappear
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r--sphinx/directives/code.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py
index 90be1557e..4e1a0e8be 100644
--- a/sphinx/directives/code.py
+++ b/sphinx/directives/code.py
@@ -9,6 +9,7 @@
import sys
import codecs
+import os
from difflib import unified_diff
from docutils import nodes
@@ -286,7 +287,7 @@ class LiteralInclude(Directive):
for line_number, line in enumerate(lines):
if not use and startafter and startafter in line:
if 'lineno-match' in self.options:
- linenostart += line_number + 2
+ linenostart += line_number + 1
use = True
elif use and endbefore and endbefore in line:
break
@@ -296,8 +297,8 @@ class LiteralInclude(Directive):
if 'lineno-match' in self.options:
# handle that preceding, empty lines ('\n') are removed.
- for line in lines[linenostart-1:]:
- if line != '\n':
+ for line in lines:
+ if line != os.linesep:
break
linenostart += 1