diff options
author | Jeppe Pihl <jpihl08@gmail.com> | 2014-10-06 13:47:58 +0200 |
---|---|---|
committer | Jeppe Pihl <jpihl08@gmail.com> | 2014-10-06 13:47:58 +0200 |
commit | 18ad1c1415db956e7a224bc34c665cb175324c50 (patch) | |
tree | 23b723477d3e9a96c213db694ca6e960e438bdaa | |
parent | 9119424dfab8181930da8a8c16683d4aad0dd249 (diff) | |
download | sphinx-18ad1c1415db956e7a224bc34c665cb175324c50.tar.gz |
fix line separator issue
-rw-r--r-- | sphinx/directives/code.py | 7 |
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 |