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:
|
2023-07-31 07:33:57 +00:00
|
|
|
return ""
|
2023-06-22 13:52:33 +00:00
|
|
|
md = f"{headline}\n\n {data['summary'][lang]}\n\n"
|
|
|
|
|
|
|
|
return md
|
|
|
|
|
2023-06-27 16:17:25 +00:00
|
|
|
|
2023-06-27 16:02:01 +00:00
|
|
|
def _publication_md(publication: str, subdued: bool):
|
|
|
|
md = "> "
|
|
|
|
if subdued:
|
|
|
|
md += "\\textcolor{publication}{"
|
|
|
|
md += publication
|
|
|
|
if subdued:
|
|
|
|
md += "}"
|
|
|
|
return f"{md}\n\n"
|
|
|
|
|
2023-06-27 16:17:25 +00:00
|
|
|
|
2023-06-27 16:02:01 +00:00
|
|
|
def experience_to_md(
|
|
|
|
data: dict[str, Any],
|
|
|
|
lang: str = "en",
|
|
|
|
headline: str = "",
|
2024-09-12 15:39:33 +00:00
|
|
|
subdued_publications: bool = True, # slightly off-color presentation
|
|
|
|
bulletpoints_show: bool = True, # display detailed bulletpoints per job
|
2023-06-27 16:02:01 +00:00
|
|
|
):
|
2023-06-22 13:52:33 +00:00
|
|
|
if "experience" not in data:
|
2023-07-31 07:33:57 +00:00
|
|
|
return ""
|
2023-06-22 13:52:33 +00:00
|
|
|
|
|
|
|
md = f"{headline}\n\n"
|
2023-06-27 16:02:01 +00:00
|
|
|
md += "\\definecolor{publication}{rgb}{0.5,0.5,0.5}\n\n"
|
2023-06-22 13:52:33 +00:00
|
|
|
for exp in data["experience"]:
|
2024-09-12 15:39:33 +00:00
|
|
|
client = exp["client"][lang] if "client" in exp else ""
|
|
|
|
title = exp["title"][lang] if "title" in exp else ""
|
|
|
|
md += (
|
|
|
|
# new python 3.12 f-string embedding niceness
|
|
|
|
f"## {title}{f", {client}" if client else ""}\\hfill{exp['date'][lang]}\n\n"
|
|
|
|
)
|
2023-06-22 13:52:33 +00:00
|
|
|
|
|
|
|
if "publication" in exp:
|
2023-06-27 16:17:25 +00:00
|
|
|
md += _publication_md(exp["publication"][lang], subdued_publications)
|
2023-06-22 13:52:33 +00:00
|
|
|
|
2024-05-29 07:05:23 +00:00
|
|
|
if bulletpoints_show:
|
|
|
|
for point in exp["bullets"]:
|
|
|
|
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-27 16:17:25 +00:00
|
|
|
def thesis_to_md(data: dict[str, Any], lang: str = "en"):
|
|
|
|
md = ""
|
|
|
|
for thesis in data["thesis"]:
|
|
|
|
md += f"{thesis['type'][lang]}\n"
|
|
|
|
md += f": {thesis['title'][lang]}\n"
|
|
|
|
md += f": {thesis['abstract'][lang]}\n"
|
|
|
|
return f"{md}\n"
|
|
|
|
|
|
|
|
|
|
|
|
def education_to_md(
|
|
|
|
data: dict[str, Any], lang: str = "en", headline: str = "", thesis: bool = True
|
|
|
|
):
|
2023-06-22 13:52:33 +00:00
|
|
|
if "education" not in data:
|
2023-07-31 07:33:57 +00:00
|
|
|
return ""
|
2023-06-22 13:52:33 +00:00
|
|
|
|
|
|
|
md = f"{headline}\n\n"
|
2023-06-27 16:17:25 +00:00
|
|
|
|
|
|
|
if thesis and "thesis" in data:
|
|
|
|
md += thesis_to_md(data, lang)
|
|
|
|
|
2023-06-22 13:52:33 +00:00
|
|
|
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:
|
2023-07-31 07:33:57 +00:00
|
|
|
return ""
|
2023-06-22 16:03:59 +00:00
|
|
|
|
|
|
|
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
|