summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeppe Pihl <jpihl08@gmail.com>2014-10-06 13:47:58 +0200
committerJeppe Pihl <jpihl08@gmail.com>2014-10-06 13:47:58 +0200
commit18ad1c1415db956e7a224bc34c665cb175324c50 (patch)
tree23b723477d3e9a96c213db694ca6e960e438bdaa
parent9119424dfab8181930da8a8c16683d4aad0dd249 (diff)
downloadsphinx-18ad1c1415db956e7a224bc34c665cb175324c50.tar.gz
fix line separator issue
-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 4e1a0e8b..aee32fe3 100644
--- a/sphinx/directives/code.py
+++ b/sphinx/directives/code.py
@@ -9,7 +9,6 @@
import sys
import codecs
-import os
from difflib import unified_diff
from docutils import nodes
@@ -296,9 +295,11 @@ class LiteralInclude(Directive):
lines = res
if 'lineno-match' in self.options:
- # handle that preceding, empty lines ('\n') are removed.
+ # handle that docutils remove preceding lines which only contains
+ # line separation.
for line in lines:
- if line != os.linesep:
+ # check if line contains anything else than line separation.
+ if line and line.splitlines()[0]:
break
linenostart += 1