This commit is contained in:
+45
-11
@@ -22,13 +22,55 @@ def main():
|
||||
if not srcdir.is_dir():
|
||||
return f'Error: "{srcdir}" is not a directory or does not exist'
|
||||
|
||||
filelist = list(srcdir.glob("*.md"))
|
||||
|
||||
# mk destdir if not exist
|
||||
if not destdir.is_dir():
|
||||
destdir.mkdir()
|
||||
|
||||
# process filelist
|
||||
# process modular resume
|
||||
srclist = (
|
||||
"contact.md",
|
||||
"summary.md",
|
||||
"skills.md",
|
||||
"projects.md",
|
||||
"education.md",
|
||||
"experience.md",
|
||||
)
|
||||
|
||||
chunks = []
|
||||
for md in srclist:
|
||||
print("processing modular resumd")
|
||||
|
||||
file = Path.joinpath(srcdir, md)
|
||||
with file.open(mode="r", encoding="utf-8") as f:
|
||||
chunks.append(f.read())
|
||||
|
||||
mdsrc = "".join(chunks)
|
||||
rawhtml = mdtohtml(mdsrc)
|
||||
base_name = "resume-mod"
|
||||
|
||||
# pretty pdf
|
||||
web_template = j2_env.get_template("resume-web.template")
|
||||
web_html = web_template.render(name=name, content=rawhtml)
|
||||
web_pdf_path = destdir / f"{base_name}-web.pdf"
|
||||
htmltopdf(web_html, web_pdf_path)
|
||||
|
||||
# ats friendly pdf
|
||||
ats_template = j2_env.get_template("resume-ats.template")
|
||||
ats_html = ats_template.render(name=name, content=rawhtml)
|
||||
ats_pdf_path = destdir / f"{base_name}-ats.pdf"
|
||||
htmltopdf(ats_html, ats_pdf_path)
|
||||
|
||||
# generate web html with download bar
|
||||
download_template = j2_env.get_template("download.template")
|
||||
download_bar = download_template.render(
|
||||
web_pdf=f"{base_name}-web.pdf", ats_pdf=f"{base_name}-ats.pdf"
|
||||
)
|
||||
|
||||
pubhtml = web_template.render(name=name, content=rawhtml, download=download_bar)
|
||||
|
||||
# process full resume source files
|
||||
filelist = list(srcdir.glob("*.md"))
|
||||
filelist = [f for f in filelist if "resume" in f.stem]
|
||||
for infile in filelist:
|
||||
print(f"processing '{infile}'...")
|
||||
|
||||
@@ -52,14 +94,6 @@ def main():
|
||||
ats_pdf_path = destdir / f"{base_name}-ats.pdf"
|
||||
htmltopdf(ats_html, ats_pdf_path)
|
||||
|
||||
# generate web html with download bar
|
||||
download_template = j2_env.get_template("download.template")
|
||||
download_bar = download_template.render(
|
||||
web_pdf=f"{base_name}-web.pdf", ats_pdf=f"{base_name}-ats.pdf"
|
||||
)
|
||||
|
||||
pubhtml = web_template.render(name=name, content=rawhtml, download=download_bar)
|
||||
|
||||
html_path = destdir / f"{base_name}.html"
|
||||
with html_path.open(mode="w", encoding="utf-8") as f:
|
||||
f.write(pubhtml)
|
||||
|
||||
Reference in New Issue
Block a user