mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix an issue with lineno-start and a flake8 violation
This commit is contained in:
parent
a2338e4838
commit
eb08ba2713
@ -256,6 +256,8 @@ class LiteralInclude(Directive):
|
||||
lines = list(diff)
|
||||
|
||||
linenostart = self.options.get('lineno-start', 1)
|
||||
if 'lineno-match' in self.options:
|
||||
linenostart = 1
|
||||
objectname = self.options.get('pyobject')
|
||||
if objectname is not None:
|
||||
from sphinx.pycode import ModuleAnalyzer
|
||||
@ -294,12 +296,12 @@ class LiteralInclude(Directive):
|
||||
res = []
|
||||
for line_number, line in enumerate(lines):
|
||||
if not use and start_str and start_str in line:
|
||||
if 'lineno-match' in self.options:
|
||||
linenostart = line_number + 1
|
||||
if start_inclusive:
|
||||
res.append(line)
|
||||
else:
|
||||
linenostart +=1
|
||||
if 'lineno-match' in self.options:
|
||||
linenostart = line_number + 1
|
||||
if not start_inclusive:
|
||||
linenostart += 1
|
||||
use = True
|
||||
elif use and end_str and end_str in line:
|
||||
if end_inclusive:
|
||||
|
Loading…
Reference in New Issue
Block a user