Skip to content

Commit

Permalink
Merge pull request akka#18671 from akka/wip-port-includecode
Browse files Browse the repository at this point in the history
+doc akka#18670 log errors when included snippet empty
  • Loading branch information
ktoso committed Oct 8, 2015
2 parents 8ebe83a + cccf6a5 commit 7bf8f51
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions akka-docs/_sphinx/exts/includecode.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ def countwhile(predicate, iterable):
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

Expand Down

0 comments on commit 7bf8f51

Please sign in to comment.