|
|
@@ -1,10 +1,30 @@
|
|
|
+n = "\n"
|
|
|
+w = " "
|
|
|
+
|
|
|
+
|
|
|
+bold = lambda x: f"**{x}:** "
|
|
|
+bold_ul = lambda x: f"**--{x}:**-- "
|
|
|
+
|
|
|
+mono = lambda x: f"`{x}`{n}"
|
|
|
+
|
|
|
+
|
|
|
def section(
|
|
|
- title: str, body: dict, indent: int = 2, underline: bool = True
|
|
|
+ title: str,
|
|
|
+ body: dict,
|
|
|
+ indent: int = 2,
|
|
|
+ underline: bool = True,
|
|
|
) -> str:
|
|
|
- text = f"**--{title}**--:\n" if underline else f"**{title}**:\n"
|
|
|
+
|
|
|
+ text = (bold_ul(title) + n) if underline else bold(title) + n
|
|
|
+
|
|
|
for key, value in body.items():
|
|
|
- if not isinstance(value, list):
|
|
|
- text += f"{' ' * indent}**{key.capitalize()}:** `{value}`\n"
|
|
|
- else:
|
|
|
- text += f"{' ' * indent}**{key.capitalize()}:** {value[0]}\n"
|
|
|
+ text += (
|
|
|
+ indent * w
|
|
|
+ + bold(key)
|
|
|
+ + (
|
|
|
+ (value[0] + n)
|
|
|
+ if isinstance(value, list)
|
|
|
+ else mono(value)
|
|
|
+ )
|
|
|
+ )
|
|
|
return text
|