diff options
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r-- | sphinx/directives/code.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py index 111f6b189..4d7e7a48d 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -311,11 +311,11 @@ class LiteralIncludeReader(object): self.lineno_start += lineno return lines[lineno:] + + if inclusive is True: + raise ValueError('start-after pattern not found: %s' % start) else: - if inclusive is True: - raise ValueError('start-after pattern not found: %s' % start) - else: - raise ValueError('start-at pattern not found: %s' % start) + raise ValueError('start-at pattern not found: %s' % start) return lines @@ -340,11 +340,10 @@ class LiteralIncludeReader(object): return [] else: return lines[:lineno] + if inclusive is True: + raise ValueError('end-at pattern not found: %s' % end) else: - if inclusive is True: - raise ValueError('end-at pattern not found: %s' % end) - else: - raise ValueError('end-before pattern not found: %s' % end) + raise ValueError('end-before pattern not found: %s' % end) return lines |