report line numbers for generated content more accurately

Show the line numbers for content generated by the formatter. Go ahead
and dump that output to the log, too, so someone can use it to debug
build errors.

Change-Id: Ib088df597d3b02e9040b90fece9552864d8f1fb7
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-05-11 17:12:04 -04:00
parent 79bebc4d15
commit 0217f4c08d
1 changed files with 3 additions and 2 deletions

View File

@ -114,8 +114,9 @@ class ReleaseNotesDirective(rst.Directive):
)
source_name = '<%s %s>' % (__name__, branch or 'current branch')
result = statemachine.ViewList()
for line in text.splitlines():
result.append(line, source_name)
for line_num, line in enumerate(text.splitlines(), 1):
info('{:>4d}: {}'.format(line_num, line))
result.append(line, source_name, line_num)
node = nodes.section()
node.document = self.state.document