Add sidebar to document

This commit is contained in:
Marty Oehme 2024-09-17 17:50:30 +02:00
parent 43549c1f53
commit 5df8458b72
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

179
cv.typ
View file

@ -17,6 +17,13 @@
"en" "en"
} }
} }
#let sel_word_lang(de: "", en:"") = {
if lang == "de" {
de
} else {
en
}
}
#let _columns_3(left_body, center_body, right_body) = { #let _columns_3(left_body, center_body, right_body) = {
block[ block[
@ -108,31 +115,34 @@
[#par(item.abstract.at(lang))] [#par(item.abstract.at(lang))]
} }
#let sel_word_lang(de: "", en:"") = { // skill-specific entry, changing its style for sidebar
if lang == "de" { #let skill_item(item: (), is_sidebar: false) = {
de let side_list(body) = if is_sidebar {list(body)} else {par(body)}
} else { for skill in item {
en side_list({
} [*#skill.name.at(lang)*]
} if is_sidebar [\ ] else [ (]
for (i,v) in skill.items.enumerate() {
// Old-style presentation of skills and qualifications, to be overhauled [#v.at(lang)]
#let skill_item(item: ()) = { if i < skill.items.len() - 1 {
[*#item.at(lang)*: \ ] [, ]
for skill in item.content { }
[#skill.name.at(lang) (]
for (i, v) in skill.items.enumerate() {
[#v.at(lang)]
if i < skill.items.len() - 1 {
[, ]
} }
} if not is_sidebar [)]
[) \ ] })
} }
} }
#let resume(contents) = { #let cv(contents) = {
// Feel free to change the margin below to best fit your own CV set text(lang: lang)
let date_formatting = {
if lang == "de" {
"[day]. [month repr:long] [year]"
} else {
"[month repr:long] [day], [year]"
}
}
set page( set page(
paper: "a4", paper: "a4",
margin: (x: 0.9cm, y: 1.3cm), margin: (x: 0.9cm, y: 1.3cm),
@ -142,14 +152,9 @@
size: 8pt, size: 8pt,
) )
#_columns_3[ #_columns_3[
#smallcaps[#datetime.today().display("[month repr:long] [day], [year]")] #smallcaps[#datetime.today().display(date_formatting)]
][ ][
#smallcaps[ #smallcaps[#contents.about.fullname]
// FIXME: Source from about.fullname variable
Marty Oehme
// #sym.dot.c
// CV
]
][ ][
#counter(page).display() #counter(page).display()
] ]
@ -160,38 +165,106 @@
header(contents.about) header(contents.about)
if "summary" in contents { let body = {
section(title:"", { if "summary" in contents {
contents.summary.at(lang) section(title:"", {
}) contents.summary.at(lang)
}; })
};
if "experience" in contents { if "experience" in contents {
let title = sel_word_lang(en:"Professional Experience", de:"Berufserfahrung") let title = sel_word_lang(en:"Professional Experience", de:"Berufserfahrung")
section(title: title, entries:contents.experience)[] section(title: title, entries:contents.experience)[]
}
if "education" in contents {
let title = sel_word_lang(en:"Education", de:"Ausbildung")
section(title: title, entries:contents.thesis + contents.education)[]
}
if "volunteering" in contents {
let title = sel_word_lang(en:"Volunteer Work", de:"Ehrenamt")
section(title: title, entries:contents.volunteering)[]
}
if "skills" in contents {
let title = sel_word_lang(en:"Qualifications", de:"Qualifikationen")
section(title: title, {
skill_item(item:contents.skills)
})
}
if "languages" in contents {
let title = sel_word_lang(en:"Languages", de:"Sprachen")
section(title: title, {
skill_item(item:contents.languages)
})
}
} }
if "education" in contents { let sidebar = {
let title = sel_word_lang(en:"Education", de:"Ausbildung") if "volunteering" in contents {
section(title: title, entries:contents.thesis + contents.education)[] let title = sel_word_lang(en:"Volunteer Work", de:"Ehrenamt")
} [== #title]
for e in contents.volunteering {
if "volunteering" in contents { [
let title = sel_word_lang(en:"Volunteer Work", de:"Ehrenamt") - *#e.title.at(lang)* (#e.date.at(lang))
section(title: title, entries:contents.volunteering)[] #par(e.bullets.at(0).at(lang)) \
} ]
if "skills" in contents {
let title = sel_word_lang(en:"Qualifications", de:"Qualifikationen")
section(title: "Qualifications", {
for cat in contents.skills {
skill_item(item:cat)
} }
}) }
if "languages" in contents {
let title = sel_word_lang(en:"Languages", de:"Sprachen")
[== #title]
skill_item(item:contents.languages, is_sidebar: true)
[\ ]
}
if "skills" in contents {
let title = sel_word_lang(en:"Qualifications", de:"Kenntnisse")
[== #title]
skill_item(item:contents.skills, is_sidebar: true)
}
} }
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
}
)
} }
#resume( #cv(
yaml("content.yml") yaml("content.yml")
) )