Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
ed84fe9
1
Parent(s):
557b91f
Format parameters into list output
Browse files- docs/gen_param_docs.py +5 -3
docs/gen_param_docs.py
CHANGED
@@ -30,15 +30,17 @@ def str_param_groups(param_groupings, params, cur_heading=2):
|
|
30 |
elif isinstance(param_groupings, str):
|
31 |
found_params.append(param_groupings)
|
32 |
|
33 |
-
clean_desc = re.sub(r"Default is .*", "", params[param_groupings].description)
|
34 |
default_value = re.search(
|
35 |
r"Default is `(.*)`", params[param_groupings].description
|
36 |
)
|
|
|
|
|
|
|
37 |
return (
|
38 |
-
f"**`{param_groupings}`**"
|
39 |
+ "\n\n"
|
40 |
+ clean_desc
|
41 |
-
+ ("\n" + f"*Default:* `{default_value.group(1)}`" if default_value else "")
|
42 |
)
|
43 |
else:
|
44 |
raise TypeError(f"Unexpected type {type(param_groupings)}")
|
|
|
30 |
elif isinstance(param_groupings, str):
|
31 |
found_params.append(param_groupings)
|
32 |
|
|
|
33 |
default_value = re.search(
|
34 |
r"Default is `(.*)`", params[param_groupings].description
|
35 |
)
|
36 |
+
clean_desc = re.sub(r"Default is .*", "", params[param_groupings].description)
|
37 |
+
# Prepend every line with 4 spaces:
|
38 |
+
clean_desc = "\n".join(" " + line for line in clean_desc.splitlines())
|
39 |
return (
|
40 |
+
f" - **`{param_groupings}`**"
|
41 |
+ "\n\n"
|
42 |
+ clean_desc
|
43 |
+
+ ("\n\n " + f"*Default:* `{default_value.group(1)}`" if default_value else "")
|
44 |
)
|
45 |
else:
|
46 |
raise TypeError(f"Unexpected type {type(param_groupings)}")
|