Marty Oehme
b6302e0ca6
Whenever an empty section was encountered we returned `None` which lead to display artifacts as Quarto tried to interpret what we actually wanted to display. Instead, we simply return an empty string which is to be 'displayed' so nothing will be shown.
85 lines
2.1 KiB
Python
85 lines
2.1 KiB
Python
from typing import Any
|
|
|
|
|
|
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
|
|
|
|
|
|
def _publication_md(publication: str, subdued: bool):
|
|
md = "> "
|
|
if subdued:
|
|
md += "\\textcolor{publication}{"
|
|
md += publication
|
|
if subdued:
|
|
md += "}"
|
|
return f"{md}\n\n"
|
|
|
|
|
|
def experience_to_md(
|
|
data: dict[str, Any],
|
|
lang: str = "en",
|
|
headline: str = "",
|
|
subdued_publications: bool = True,
|
|
):
|
|
if "experience" not in data:
|
|
return ""
|
|
|
|
md = f"{headline}\n\n"
|
|
md += "\\definecolor{publication}{rgb}{0.5,0.5,0.5}\n\n"
|
|
for exp in data["experience"]:
|
|
md += f"## {exp['title'][lang]}\\hfill{exp['date'][lang]}\n\n"
|
|
|
|
if "publication" in exp:
|
|
md += _publication_md(exp["publication"][lang], subdued_publications)
|
|
|
|
for point in exp["bullets"]:
|
|
md += f"* {point[lang]}\n"
|
|
md += "\n\n"
|
|
|
|
return md
|
|
|
|
|
|
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
|
|
):
|
|
if "education" not in data:
|
|
return ""
|
|
|
|
md = f"{headline}\n\n"
|
|
|
|
if thesis and "thesis" in data:
|
|
md += thesis_to_md(data, lang)
|
|
|
|
for edu in data["education"]:
|
|
md += (
|
|
f"{edu['place'][lang]}\n\n: {edu['program'][lang]}; {edu['date'][lang]}\n\n"
|
|
)
|
|
|
|
return md
|
|
|
|
|
|
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
|