+doc #18670 log errors when included snippet empty
Forward port of #18670
This commit is contained in:
parent
2382aacdee
commit
cccf6a5b85
1 changed files with 5 additions and 0 deletions
|
|
@ -109,6 +109,11 @@ class IncludeCode(Directive):
|
|||
return count
|
||||
|
||||
nonempty = filter(lambda l: l.strip(), lines)
|
||||
if not nonempty:
|
||||
return [document.reporter.error(
|
||||
"Snippet ({}#{}) not found!".format(filename, section),
|
||||
line=self.lineno
|
||||
)]
|
||||
tabcounts = map(lambda l: countwhile(lambda c: c == ' ', l), nonempty)
|
||||
tabshift = min(tabcounts) if tabcounts else 0
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue