File tree 1 file changed +9
-12
lines changed
1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change 2
2
3
3
# Build the gh-pages
4
4
5
+ from collections import OrderedDict
5
6
import re
6
7
import sys
7
8
import json
@@ -21,33 +22,29 @@ def parse_lint_def(lint):
21
22
lint_dict ['id' ] = lint .name
22
23
lint_dict ['group' ] = lint .group
23
24
lint_dict ['level' ] = lint .level
24
- lint_dict ['docs' ] = {}
25
+ lint_dict ['docs' ] = OrderedDict ()
25
26
26
27
last_section = None
27
28
28
29
for line in lint .doc :
29
- if len (line .strip ()) == 0 and not last_section .startswith ("Example" ):
30
- continue
31
-
32
30
match = re .match (lint_subheadline , line )
33
31
if match :
34
32
last_section = match .groups ()[0 ]
35
- if match :
36
33
text = match .groups ()[1 ]
37
34
else :
38
35
text = line
39
36
40
37
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" )
42
39
log .debug ("in lint `%s`, line `%s`" , lint .name , line )
43
40
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 "
49
45
50
- lint_dict ['docs' ][last_section ] = line
46
+ for section in lint_dict ['docs' ]:
47
+ lint_dict ['docs' ][section ] = lint_dict ['docs' ][section ].strip ()
51
48
52
49
return lint_dict
53
50
You can’t perform that action at this time.
0 commit comments