2023-06-22 13:52:33 +00:00
|
|
|
from typing import Any
|
|
|
|
|
2023-06-22 16:03:59 +00:00
|
|
|
|
2023-06-22 13:52:33 +00:00
|
|
|
def summary_to_md(data: dict[str, Any], lang: str = "en", headline: str = ""):
|
|
|
|
if "summary" not in data:
|
|
|
|
return
|
|
|
|
md = f"{headline}\n\n {data['summary'][lang]}\n\n"
|
|
|
|
|
|
|
|
return md
|
|
|
|
|
2023-06-22 16:03:59 +00:00
|
|
|
|
2023-06-22 13:52:33 +00:00
|
|
|
def experience_to_md(data: dict[str, Any], lang: str = "en", headline: str = ""):
|
|
|
|
if "experience" not in data:
|
|
|
|
return
|
|
|
|
|
|
|
|
md = f"{headline}\n\n"
|
|
|
|
for exp in data["experience"]:
|
|
|
|
md += f"## {exp['title'][lang]}\\hfill{exp['date'][lang]}\n\n"
|
|
|
|
|
|
|
|
if "publication" in exp:
|
|
|
|
md += f"> {exp['publication'][lang]}\n\n"
|
|
|
|
|
|
|
|
for point in exp["bullets"]:
|
2023-06-22 16:03:59 +00:00
|
|
|
md += f"* {point[lang]}\n"
|
2023-06-26 14:28:34 +00:00
|
|
|
md += "\n\n"
|
2023-06-22 13:52:33 +00:00
|
|
|
|
|
|
|
return md
|
|
|
|
|
2023-06-22 16:03:59 +00:00
|
|
|
|
2023-06-22 13:52:33 +00:00
|
|
|
def education_to_md(data: dict[str, Any], lang: str = "en", headline: str = ""):
|
|
|
|
if "education" not in data:
|
|
|
|
return
|
|
|
|
|
|
|
|
md = f"{headline}\n\n"
|
|
|
|
for edu in data["education"]:
|
|
|
|
md += (
|
2023-06-22 16:03:59 +00:00
|
|
|
f"{edu['place'][lang]}\n\n: {edu['program'][lang]}; {edu['date'][lang]}\n\n"
|
2023-06-22 13:52:33 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
return md
|
2023-06-22 16:03:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
def qualifications_to_md(data: dict[str, Any], lang: str = "en", headline: str = ""):
|
|
|
|
if "skills" not in data:
|
|
|
|
return
|
|
|
|
|
|
|
|
md = f"{headline}\n\n"
|
|
|
|
for skillset in data["skills"]:
|
|
|
|
md += f"{skillset[lang]}\n\n"
|
|
|
|
for content in skillset["content"]:
|
|
|
|
md += f": {content['name'][lang]} ({', '.join([item[lang] for item in content['items']])})\n"
|
|
|
|
md += "\n"
|
|
|
|
|
|
|
|
return md
|