Add processing for thesis content into document

This commit is contained in:
Marty Oehme 2023-06-27 18:17:25 +02:00
parent 113e2a3c53
commit d6270773c9
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -8,6 +8,7 @@ def summary_to_md(data: dict[str, Any], lang: str = "en", headline: str = ""):
return md return md
def _publication_md(publication: str, subdued: bool): def _publication_md(publication: str, subdued: bool):
md = "> " md = "> "
if subdued: if subdued:
@ -17,6 +18,7 @@ def _publication_md(publication: str, subdued: bool):
md += "}" md += "}"
return f"{md}\n\n" return f"{md}\n\n"
def experience_to_md( def experience_to_md(
data: dict[str, Any], data: dict[str, Any],
lang: str = "en", lang: str = "en",
@ -32,7 +34,7 @@ def experience_to_md(
md += f"## {exp['title'][lang]}\\hfill{exp['date'][lang]}\n\n" md += f"## {exp['title'][lang]}\\hfill{exp['date'][lang]}\n\n"
if "publication" in exp: if "publication" in exp:
md += _publication_md(exp['publication'][lang], subdued_publications) md += _publication_md(exp["publication"][lang], subdued_publications)
for point in exp["bullets"]: for point in exp["bullets"]:
md += f"* {point[lang]}\n" md += f"* {point[lang]}\n"
@ -41,11 +43,26 @@ def experience_to_md(
return md return md
def education_to_md(data: dict[str, Any], lang: str = "en", headline: str = ""): 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: if "education" not in data:
return return
md = f"{headline}\n\n" md = f"{headline}\n\n"
if thesis and "thesis" in data:
md += thesis_to_md(data, lang)
for edu in data["education"]: for edu in data["education"]:
md += ( md += (
f"{edu['place'][lang]}\n\n: {edu['program'][lang]}; {edu['date'][lang]}\n\n" f"{edu['place'][lang]}\n\n: {edu['program'][lang]}; {edu['date'][lang]}\n\n"