Skip to content

Commit 4ce100b

Browse files
committed
don't strip blank lines in lint documentation
1 parent c5d1ecd commit 4ce100b

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

util/export.py

+9-12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Build the gh-pages
44

5+
from collections import OrderedDict
56
import re
67
import sys
78
import json
@@ -21,33 +22,29 @@ def parse_lint_def(lint):
2122
lint_dict['id'] = lint.name
2223
lint_dict['group'] = lint.group
2324
lint_dict['level'] = lint.level
24-
lint_dict['docs'] = {}
25+
lint_dict['docs'] = OrderedDict()
2526

2627
last_section = None
2728

2829
for line in lint.doc:
29-
if len(line.strip()) == 0 and not last_section.startswith("Example"):
30-
continue
31-
3230
match = re.match(lint_subheadline, line)
3331
if match:
3432
last_section = match.groups()[0]
35-
if match:
3633
text = match.groups()[1]
3734
else:
3835
text = line
3936

4037
if not last_section:
41-
log.warn("Skipping comment line as it was not preceded by a heading")
38+
log.warning("Skipping comment line as it was not preceded by a heading")
4239
log.debug("in lint `%s`, line `%s`", lint.name, line)
4340

44-
fragment = lint_dict['docs'].get(last_section, "")
45-
if text == "\n":
46-
line = fragment + text
47-
else:
48-
line = (fragment + "\n" + text).strip()
41+
if last_section not in lint_dict['docs']:
42+
lint_dict['docs'][last_section] = ""
43+
44+
lint_dict['docs'][last_section] += text + "\n"
4945

50-
lint_dict['docs'][last_section] = line
46+
for section in lint_dict['docs']:
47+
lint_dict['docs'][section] = lint_dict['docs'][section].strip()
5148

5249
return lint_dict
5350

0 commit comments

Comments
 (0)