Prepare structure for inserting dynamic content
This commit is contained in:
parent
2d8dbedd4d
commit
14be4ea1ca
9 changed files with 184 additions and 375 deletions
0
processing/__init__.py
Normal file
0
processing/__init__.py
Normal file
36
processing/content.py
Normal file
36
processing/content.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
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]}\n\n"
|
||||
|
||||
for point in exp["bullets"]:
|
||||
md+=f"* {point[lang]}\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
|
||||
9
processing/yml.py
Normal file
9
processing/yml.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import yaml
|
||||
|
||||
DEFAULT_FILE = "content.yml"
|
||||
|
||||
|
||||
def parse(fname: str = DEFAULT_FILE):
|
||||
with open(fname, mode="rb") as f:
|
||||
return yaml.safe_load(f)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue