File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change 22
33# Build the gh-pages
44
5+ from collections import OrderedDict
56import re
67import sys
78import 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
You can’t perform that action at this time.
0 commit comments