]> git.lizzy.rs Git - rust.git/blobdiff - util/export.py
Merge pull request #2977 from flip1995/tool_lints
[rust.git] / util / export.py
index ae8e4a72c08d8827efeed86d9f27844fbfc719f5..5419624d48e54fe5703954943e0fbe2c3f3d5e90 100755 (executable)
@@ -18,13 +18,14 @@ This lint has the following configuration variables:
 def parse_lint_def(lint):
     lint_dict = {}
     lint_dict['id'] = lint.name
+    lint_dict['group'] = lint.group
     lint_dict['level'] = lint.level
     lint_dict['docs'] = {}
 
     last_section = None
 
     for line in lint.doc:
-        if len(line.strip()) == 0:
+        if len(line.strip()) == 0 and not last_section.startswith("Example"):
             continue
 
         match = re.match(lint_subheadline, line)
@@ -39,8 +40,13 @@ def parse_lint_def(lint):
             log.warn("Skipping comment line as it was not preceded by a heading")
             log.debug("in lint `%s`, line `%s`", lint.name, line)
 
-        lint_dict['docs'][last_section] = \
-            (lint_dict['docs'].get(last_section, "") + "\n" + text).strip()
+        fragment = lint_dict['docs'].get(last_section, "")
+        if text == "\n":
+            line = fragment + text
+        else:
+            line = (fragment + "\n" + text).strip()
+
+        lint_dict['docs'][last_section] = line
 
     return lint_dict