resume/processing/content.py
Marty Oehme 14c6c8ccfb
Fix printing None if no publication for entry
No adding an empty string to the resulting markdown instead of the
actual content of the dict ('None') to the text.
2023-06-27 10:38:56 +02:00

55 lines
1.4 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 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] or ''}\n\n"
for point in exp["bullets"]:
md += f"* {point[lang]}\n"
md += "\n\n"
return md
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 += (
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