ref(repo): Refactor resume into single importable function
Moved all 'behind-the-scenes' structure to 'lib/' folder and made resume importable as the main utility.
This commit is contained in:
parent
eace89411b
commit
21d2010762
6 changed files with 171 additions and 318 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -51,7 +51,6 @@ dist/
|
||||||
downloads/
|
downloads/
|
||||||
eggs/
|
eggs/
|
||||||
.eggs/
|
.eggs/
|
||||||
lib/
|
|
||||||
lib64/
|
lib64/
|
||||||
parts/
|
parts/
|
||||||
sdist/
|
sdist/
|
||||||
|
|
@ -62,6 +61,7 @@ share/python-wheels/
|
||||||
.installed.cfg
|
.installed.cfg
|
||||||
*.egg
|
*.egg
|
||||||
MANIFEST
|
MANIFEST
|
||||||
|
# lib/
|
||||||
|
|
||||||
# PyInstaller
|
# PyInstaller
|
||||||
# Usually these files are written by a python script from a template
|
# Usually these files are written by a python script from a template
|
||||||
|
|
|
||||||
161
cv.typ
161
cv.typ
|
|
@ -1,157 +1,8 @@
|
||||||
#import "lib.typ": *
|
#import "lib/resume.typ": resume
|
||||||
|
|
||||||
#let cv(contents, use_sidebar: false) = {
|
#resume.with(
|
||||||
show: style
|
content: yaml("content.yml"),
|
||||||
show: smartypants
|
main: ("summary", "experience", "education", "volunteering", "skills", "languages"),
|
||||||
set text(lang: lang)
|
sidebar:(),
|
||||||
|
)
|
||||||
let date_formatting = {
|
|
||||||
if lang == "de" {
|
|
||||||
"[day]. [month repr:long] [year]"
|
|
||||||
} else {
|
|
||||||
"[month repr:long] [day], [year]"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set page(
|
|
||||||
paper: "a4",
|
|
||||||
margin: (x: 0.9cm, y: 1.3cm),
|
|
||||||
footer: [
|
|
||||||
#set text(
|
|
||||||
fill: luma(200),
|
|
||||||
size: 8pt,
|
|
||||||
)
|
|
||||||
#_columns_3[
|
|
||||||
#smallcaps[#datetime.today().display(date_formatting)]
|
|
||||||
][
|
|
||||||
#smallcaps[#contents.about.fullname]
|
|
||||||
][
|
|
||||||
#context counter(page).display()
|
|
||||||
]
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
set par(justify: true)
|
|
||||||
|
|
||||||
header(contents.about)
|
|
||||||
|
|
||||||
let body = {
|
|
||||||
if "summary" in contents {
|
|
||||||
section(
|
|
||||||
title: "",
|
|
||||||
{
|
|
||||||
contents.summary.at(lang)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if "experience" in contents {
|
|
||||||
let title = (en: "Professional Experience", de: "Berufserfahrung").at(lang)
|
|
||||||
section(title: title, entries: contents.experience)[]
|
|
||||||
}
|
|
||||||
|
|
||||||
if "education" in contents {
|
|
||||||
let title = (en: "Education", de: "Ausbildung").at(lang)
|
|
||||||
section(title: title, entries: contents.thesis + contents.education)[]
|
|
||||||
}
|
|
||||||
|
|
||||||
if not use_sidebar {
|
|
||||||
if "volunteering" in contents {
|
|
||||||
let title = (en: "Volunteer Work", de: "Ehrenamt").at(lang)
|
|
||||||
section(title: title, entries: contents.volunteering)[]
|
|
||||||
}
|
|
||||||
|
|
||||||
if "skills" in contents {
|
|
||||||
let title = (en: "Qualifications", de: "Qualifikationen").at(lang)
|
|
||||||
section(
|
|
||||||
title: title,
|
|
||||||
{
|
|
||||||
sidebar_entry(item: contents.skills)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if "languages" in contents {
|
|
||||||
let title = (en: "Languages", de: "Sprachen").at(lang)
|
|
||||||
section(
|
|
||||||
title: title,
|
|
||||||
{
|
|
||||||
sidebar_entry(item: contents.languages)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let sidebar = {
|
|
||||||
if "volunteering" in contents {
|
|
||||||
let title = (en: "Volunteer Work", de: "Ehrenamt").at(lang)
|
|
||||||
[== #title]
|
|
||||||
for e in contents.volunteering {
|
|
||||||
[
|
|
||||||
- *#e.title.at(lang)* (#e.date.at(lang))
|
|
||||||
#par(e.bullets.at(0).at(lang)) \
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if "languages" in contents {
|
|
||||||
let title = (en: "Languages", de: "Sprachen").at(lang)
|
|
||||||
[== #title]
|
|
||||||
sidebar_entry(item: contents.languages, is_sidebar: true)
|
|
||||||
[\ ]
|
|
||||||
}
|
|
||||||
|
|
||||||
if "skills" in contents {
|
|
||||||
let title = (en: "Qualifications", de: "Kenntnisse").at(lang)
|
|
||||||
[== #title]
|
|
||||||
sidebar_entry(item: contents.skills, is_sidebar: true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if not use_sidebar {
|
|
||||||
body
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let margin = 1pt
|
|
||||||
grid(
|
|
||||||
columns: (2fr, 1fr),
|
|
||||||
block(
|
|
||||||
outset: 0pt,
|
|
||||||
inset: (top: 0.4 * margin, right: 0pt, rest: margin),
|
|
||||||
stroke: none,
|
|
||||||
width: 100%,
|
|
||||||
{
|
|
||||||
set block(above: 10pt)
|
|
||||||
show heading.where(level: 1): it => style(s => {
|
|
||||||
let h = text(size: 18pt, upper(it))
|
|
||||||
let dim = measure(h, s)
|
|
||||||
stack(
|
|
||||||
dir: ltr,
|
|
||||||
h,
|
|
||||||
place(
|
|
||||||
dy: 7pt,
|
|
||||||
dx: 10pt,
|
|
||||||
horizon + left,
|
|
||||||
line(stroke: accent-color, length: 100% - dim.width - 10pt),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
body
|
|
||||||
},
|
|
||||||
),
|
|
||||||
{
|
|
||||||
v(20pt)
|
|
||||||
set block(inset: (left: 20 * margin, right: 20 * margin))
|
|
||||||
show heading: it => align(right, upper(it))
|
|
||||||
set list(marker: "")
|
|
||||||
show list: it => {
|
|
||||||
set par(justify: false)
|
|
||||||
align(right, block(it))
|
|
||||||
}
|
|
||||||
sidebar
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
#cv.with(use_sidebar: false)(yaml("content.yml"))
|
|
||||||
|
|
||||||
|
|
|
||||||
162
lib/resume.typ
Normal file
162
lib/resume.typ
Normal file
|
|
@ -0,0 +1,162 @@
|
||||||
|
#import "lib.typ": *
|
||||||
|
#import "wrapit.typ": *
|
||||||
|
|
||||||
|
#let create_body(main: (), contents: (:)) = {
|
||||||
|
for item in main {
|
||||||
|
if item == "summary" and "summary" in contents {
|
||||||
|
section(
|
||||||
|
title: "",
|
||||||
|
{
|
||||||
|
contents.summary.at(lang)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if item == "experience_by_type" and "experience" in contents {
|
||||||
|
let title = (en: "Professional Experience", de: "Berufserfahrung").at(lang)
|
||||||
|
section(title: title)[]
|
||||||
|
by_experience_type(experience: contents.experience, type: contents.experience_types)
|
||||||
|
}
|
||||||
|
if item == "experience_by_client" and "experience" in contents {
|
||||||
|
let title = (en: "Professional Experience", de: "Berufserfahrung").at(lang)
|
||||||
|
section(title: title)[]
|
||||||
|
by_client(experience: contents.experience)
|
||||||
|
}
|
||||||
|
if item == "experience" and "experience" in contents {
|
||||||
|
let title = (en: "Professional Experience", de: "Berufserfahrung").at(lang)
|
||||||
|
section(title: title, entries: contents.experience)[]
|
||||||
|
}
|
||||||
|
|
||||||
|
if item == "education" and "education" in contents {
|
||||||
|
let title = (en: "Education", de: "Ausbildung").at(lang)
|
||||||
|
section(title: title, entries: contents.thesis + contents.education)[]
|
||||||
|
}
|
||||||
|
|
||||||
|
if item == "volunteering" and "volunteering" in contents {
|
||||||
|
let title = (en: "Volunteer Work", de: "Ehrenamt").at(lang)
|
||||||
|
section(title: title, entries: contents.volunteering)[]
|
||||||
|
}
|
||||||
|
|
||||||
|
if item == "skills" and "skills" in contents {
|
||||||
|
let title = (en: "Qualifications", de: "Qualifikationen").at(lang)
|
||||||
|
section(
|
||||||
|
title: title,
|
||||||
|
{
|
||||||
|
sidebar_entry(item: contents.skills)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if item == "languages" and "languages" in contents {
|
||||||
|
let title = (en: "Languages", de: "Sprachen").at(lang)
|
||||||
|
section(
|
||||||
|
title: title,
|
||||||
|
{
|
||||||
|
sidebar_entry(item: contents.languages)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#let create_sidebar(sidebar: (), contents: (:)) = {
|
||||||
|
for item in sidebar {
|
||||||
|
if item == "volunteering" and "volunteering" in contents {
|
||||||
|
let title = (en: "Volunteer Work", de: "Ehrenamt").at(lang)
|
||||||
|
[== #title]
|
||||||
|
for e in contents.at("volunteering") {
|
||||||
|
[
|
||||||
|
- *#e.title.at(lang)* (#e.date.at(lang))
|
||||||
|
#par(e.bullets.at(0).at(lang)) \
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if item == "languages" and "languages" in contents {
|
||||||
|
let title = (en: "Languages", de: "Sprachen").at(lang)
|
||||||
|
[== #title]
|
||||||
|
sidebar_entry(item: contents.languages, is_sidebar: true)
|
||||||
|
[\ ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if item == "skills" and "skills" in contents {
|
||||||
|
let title = (en: "Qualifications", de: "Kenntnisse").at(lang)
|
||||||
|
[== #title]
|
||||||
|
sidebar_entry(item: contents.skills, is_sidebar: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#let resume(contents, main: ("experience_by_type", "education"), sidebar: ("volunteering", "languages", "skills")) = {
|
||||||
|
show: style
|
||||||
|
set text(lang: lang)
|
||||||
|
|
||||||
|
let date_formatting = {
|
||||||
|
if lang == "de" {
|
||||||
|
"[day]. [month repr:long] [year]"
|
||||||
|
} else {
|
||||||
|
"[month repr:long] [day], [year]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set page(
|
||||||
|
paper: "a4",
|
||||||
|
margin: (x: 0.9cm, y: 1.3cm),
|
||||||
|
footer: [
|
||||||
|
#set text(
|
||||||
|
fill: luma(200),
|
||||||
|
size: 8pt,
|
||||||
|
)
|
||||||
|
#_columns_3[
|
||||||
|
#smallcaps[#datetime.today().display(date_formatting)]
|
||||||
|
][
|
||||||
|
#smallcaps[#contents.about.fullname]
|
||||||
|
][
|
||||||
|
#context counter(page).display()
|
||||||
|
]
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
set par(justify: true)
|
||||||
|
|
||||||
|
header(contents.about)
|
||||||
|
|
||||||
|
set block(above: 10pt)
|
||||||
|
show heading.where(level: 1): it => style(s => {
|
||||||
|
let h = text(size: 18pt, upper(it))
|
||||||
|
let dim = measure(h, s)
|
||||||
|
stack(
|
||||||
|
dir: ltr,
|
||||||
|
h,
|
||||||
|
place(
|
||||||
|
dy: 7pt,
|
||||||
|
dx: 10pt,
|
||||||
|
horizon + left,
|
||||||
|
line(stroke: accent-color, length: 100% - dim.width - 10pt),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
let margin = 1pt
|
||||||
|
let sb = if sidebar.len() > 0 {
|
||||||
|
block(
|
||||||
|
fill: luma(230),
|
||||||
|
inset: (top: 15 * margin, left: 10 * margin, right: 15 * margin, bottom: 15 * margin),
|
||||||
|
{
|
||||||
|
show heading: it => align(right, upper(it))
|
||||||
|
set list(marker: "")
|
||||||
|
show list: it => {
|
||||||
|
set par(justify: false)
|
||||||
|
align(right, block(it))
|
||||||
|
}
|
||||||
|
create_sidebar(sidebar: sidebar, contents: contents)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
} else { [] }
|
||||||
|
wrap-content(
|
||||||
|
sb,
|
||||||
|
create_body(main: main, contents: contents),
|
||||||
|
align: top + right,
|
||||||
|
columns: (auto, 30%),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
164
resume.typ
164
resume.typ
|
|
@ -1,163 +1,3 @@
|
||||||
#import "lib.typ": *
|
#import "lib/resume.typ": resume
|
||||||
#import "wrapit.typ": *
|
|
||||||
|
|
||||||
#let create_body(main: (), contents: (:)) = {
|
#resume.with()(yaml("content.yml"))
|
||||||
for item in main {
|
|
||||||
if item == "summary" and "summary" in contents {
|
|
||||||
section(
|
|
||||||
title: "",
|
|
||||||
{
|
|
||||||
contents.summary.at(lang)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if item == "experience_by_type" and "experience" in contents {
|
|
||||||
let title = (en: "Professional Experience", de: "Berufserfahrung").at(lang)
|
|
||||||
section(title: title)[]
|
|
||||||
by_experience_type(experience: contents.experience, type: contents.experience_types)
|
|
||||||
}
|
|
||||||
if item == "experience_by_client" and "experience" in contents {
|
|
||||||
let title = (en: "Professional Experience", de: "Berufserfahrung").at(lang)
|
|
||||||
section(title: title)[]
|
|
||||||
by_client(experience: contents.experience)
|
|
||||||
}
|
|
||||||
if item == "experience" and "experience" in contents {
|
|
||||||
let title = (en: "Professional Experience", de: "Berufserfahrung").at(lang)
|
|
||||||
section(title: title, entries: contents.experience)[]
|
|
||||||
}
|
|
||||||
|
|
||||||
if item == "education" and "education" in contents {
|
|
||||||
let title = (en: "Education", de: "Ausbildung").at(lang)
|
|
||||||
section(title: title, entries: contents.thesis + contents.education)[]
|
|
||||||
}
|
|
||||||
|
|
||||||
if item == "volunteering" and "volunteering" in contents {
|
|
||||||
let title = (en: "Volunteer Work", de: "Ehrenamt").at(lang)
|
|
||||||
section(title: title, entries: contents.volunteering)[]
|
|
||||||
}
|
|
||||||
|
|
||||||
if item == "skills" and "skills" in contents {
|
|
||||||
let title = (en: "Qualifications", de: "Qualifikationen").at(lang)
|
|
||||||
section(
|
|
||||||
title: title,
|
|
||||||
{
|
|
||||||
sidebar_entry(item: contents.skills)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if item == "languages" and "languages" in contents {
|
|
||||||
let title = (en: "Languages", de: "Sprachen").at(lang)
|
|
||||||
section(
|
|
||||||
title: title,
|
|
||||||
{
|
|
||||||
sidebar_entry(item: contents.languages)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#let create_sidebar(sidebar: (), contents: (:)) = {
|
|
||||||
for item in sidebar {
|
|
||||||
if item == "volunteering" and "volunteering" in contents {
|
|
||||||
let title = (en: "Volunteer Work", de: "Ehrenamt").at(lang)
|
|
||||||
[== #title]
|
|
||||||
for e in contents.at("volunteering") {
|
|
||||||
[
|
|
||||||
- *#e.title.at(lang)* (#e.date.at(lang))
|
|
||||||
#par(e.bullets.at(0).at(lang)) \
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if item == "languages" and "languages" in contents {
|
|
||||||
let title = (en: "Languages", de: "Sprachen").at(lang)
|
|
||||||
[== #title]
|
|
||||||
sidebar_entry(item: contents.languages, is_sidebar: true)
|
|
||||||
[\ ]
|
|
||||||
}
|
|
||||||
|
|
||||||
if item == "skills" and "skills" in contents {
|
|
||||||
let title = (en: "Qualifications", de: "Kenntnisse").at(lang)
|
|
||||||
[== #title]
|
|
||||||
sidebar_entry(item: contents.skills, is_sidebar: true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#let resume(contents, main: ("experience", "education"), sidebar: ("volunteering", "languages", "skills")) = {
|
|
||||||
show: style
|
|
||||||
set text(lang: lang)
|
|
||||||
|
|
||||||
let date_formatting = {
|
|
||||||
if lang == "de" {
|
|
||||||
"[day]. [month repr:long] [year]"
|
|
||||||
} else {
|
|
||||||
"[month repr:long] [day], [year]"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set page(
|
|
||||||
paper: "a4",
|
|
||||||
margin: (x: 0.9cm, y: 1.3cm),
|
|
||||||
footer: [
|
|
||||||
#set text(
|
|
||||||
fill: luma(200),
|
|
||||||
size: 8pt,
|
|
||||||
)
|
|
||||||
#_columns_3[
|
|
||||||
#smallcaps[#datetime.today().display(date_formatting)]
|
|
||||||
][
|
|
||||||
#smallcaps[#contents.about.fullname]
|
|
||||||
][
|
|
||||||
#context counter(page).display()
|
|
||||||
]
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
set par(justify: true)
|
|
||||||
|
|
||||||
header(contents.about)
|
|
||||||
|
|
||||||
set block(above: 10pt)
|
|
||||||
show heading.where(level: 1): it => style(s => {
|
|
||||||
let h = text(size: 18pt, upper(it))
|
|
||||||
let dim = measure(h, s)
|
|
||||||
stack(
|
|
||||||
dir: ltr,
|
|
||||||
h,
|
|
||||||
place(
|
|
||||||
dy: 7pt,
|
|
||||||
dx: 10pt,
|
|
||||||
horizon + left,
|
|
||||||
line(stroke: accent-color, length: 100% - dim.width - 10pt),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
let margin = 1pt
|
|
||||||
let sb = if sidebar.len() > 0 {
|
|
||||||
block(
|
|
||||||
fill: luma(230),
|
|
||||||
inset: (top: 15 * margin, left: 10 * margin, right: 15 * margin, bottom: 15 * margin),
|
|
||||||
{
|
|
||||||
show heading: it => align(right, upper(it))
|
|
||||||
set list(marker: "")
|
|
||||||
show list: it => {
|
|
||||||
set par(justify: false)
|
|
||||||
align(right, block(it))
|
|
||||||
}
|
|
||||||
create_sidebar(sidebar: sidebar, contents: contents)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
} else { [] }
|
|
||||||
wrap-content(
|
|
||||||
sb,
|
|
||||||
create_body(main: main, contents: contents),
|
|
||||||
align: top + right,
|
|
||||||
columns: (auto, 30%),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
#resume(yaml("content.yml"))
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue