+doc #18670 log errors when included snippet empty

Forward port of #18670
This commit is contained in:
Konrad Malawski 2015-10-08 12:00:09 +02:00
parent 2382aacdee
commit cccf6a5b85

View file

@ -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