Skip to content

Commit bca08dd

Browse files
committed
Fix bug where header would insert extra empty line
1 parent 25e4290 commit bca08dd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

scripts/reformat_docs.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,12 @@ def replace_block(
199199
{f.name: f.contents for f in parse_fields(block_contents.group(1))})
200200

201201
if header_formatter.is_block_valid(block):
202-
return '%s%s\n' % (
203-
block_contents.group(0),
204-
header_formatter.convert(header_from_block(block)))
202+
converted = header_formatter.convert(header_from_block(block))
203+
if converted:
204+
return '%s%s' % (
205+
block_contents.group(0),
206+
header_formatter.convert(header_from_block(block)) + '\n')
207+
return block_contents.group(0)
205208

206209
if class_formatter.is_block_valid(block):
207210
return class_formatter.convert(class_from_block(block))

0 commit comments

Comments
 (0)