Format with typstyle

This commit is contained in:
Marty Oehme 2025-01-28 21:30:12 +01:00
parent 64dffb43d6
commit 18df7051e7
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
2 changed files with 491 additions and 439 deletions

120
cv.typ
View file

@ -17,7 +17,7 @@
"en" "en"
} }
} }
#let sel_word_lang(de: "", en:"") = { #let sel_word_lang(de: "", en: "") = {
if lang == "de" { if lang == "de" {
de de
} else { } else {
@ -40,23 +40,25 @@
} }
#let header(about, columns: (1.5fr, 1fr, 1fr)) = { #let header(about, columns: (1.5fr, 1fr, 1fr)) = {
[= #about.fullname]; [= #about.fullname]
let contact_fields = (for c in about.contact { let contact_fields = (
for c in about.contact {
if "link" in c { if "link" in c {
([#c.icon ~ #link(c.link)[#c.text]],) ([#c.icon ~ #link(c.link)[#c.text]],)
} else { } else {
([#c.icon ~ #c.text],) ([#c.icon ~ #c.text],)
} }
}) }
)
grid( grid(
columns: columns, columns: columns,
gutter: 5pt, gutter: 5pt,
..contact_fields ..contact_fields
); )
} }
#let subdued(body) = { #let subdued(body) = {
block(inset: 5%, width: 85%, text(fill:luma(150), body)) block(inset: 5%, width: 85%, text(fill: luma(150), body))
} }
#let entry(item: ()) = { #let entry(item: ()) = {
@ -80,21 +82,28 @@
} }
if "publication" in item { if "publication" in item {
subdued[#item.publication.at(lang) \ ] subdued[#item.publication.at(lang) \ ]
}; }
if "abstract" in item { if "abstract" in item {
subdued[#item.abstract.at(lang) \ ] subdued[#item.abstract.at(lang) \ ]
} }
} }
#let horizon_line() = {v(-3pt); line(length: 100%); v(-5pt)} #let horizon_line() = {
v(-3pt)
line(length: 100%)
v(-5pt)
}
#let section_header(title) = {[== #title]; horizon_line()}; #let section_header(title) = {
[== #title]
horizon_line()
};
#let section(title: "Section", entries: (), body) = { #let section(title: "Section", entries: (), body) = {
section_header(title); section_header(title)
if body == none or body == [] { if body == none or body == [] {
for e in entries { for e in entries {
entry(item:e) entry(item: e)
} }
} else { } else {
body body
@ -103,26 +112,29 @@
// Slightly re-styled entry with PLACE first and TITLE second // Slightly re-styled entry with PLACE first and TITLE second
#let education_entry(item: ()) = { #let education_entry(item: ()) = {
assert("place" in item and "title" in item and "date" in item, message: "Education items require place, program and date."); assert(
[*#item.place.at(lang)*, #item.title.at(lang) #h(1fr)]; "place" in item and "title" in item and "date" in item,
[ _#item.date.at(lang)_ \ ]; message: "Education items require place, program and date.",
)
[*#item.place.at(lang)*, #item.title.at(lang) #h(1fr)]
[ _#item.date.at(lang)_ \ ]
} }
// Restyled entry with PLACE not emphasized like usual, and no date but an abstract // Restyled entry with PLACE not emphasized like usual, and no date but an abstract
#let thesis_entry(item: ()) = { #let thesis_entry(item: ()) = {
assert("title" in item and "place" in item, message: "Thesis items require type and title."); assert("title" in item and "place" in item, message: "Thesis items require type and title.")
[*#item.title.at(lang)* #item.place.at(lang) #h(1fr)]; [*#item.title.at(lang)* #item.place.at(lang) #h(1fr)]
[#par(item.abstract.at(lang))] [#par(item.abstract.at(lang))]
} }
// skill-specific entry, changing its style for sidebar // skill-specific entry, changing its style for sidebar
#let skill_item(item: (), is_sidebar: false) = { #let skill_item(item: (), is_sidebar: false) = {
let side_list(body) = if is_sidebar {list(body)} else {par(body)} let side_list(body) = if is_sidebar { list(body) } else { par(body) }
for skill in item { for skill in item {
side_list({ side_list({
[*#skill.name.at(lang)*] [*#skill.name.at(lang)*]
if is_sidebar [\ ] else [ (] if is_sidebar [\ ] else [ (]
for (i,v) in skill.items.enumerate() { for (i, v) in skill.items.enumerate() {
[#v.at(lang)] [#v.at(lang)]
if i < skill.items.len() - 1 { if i < skill.items.len() - 1 {
[, ] [, ]
@ -167,46 +179,55 @@
let body = { let body = {
if "summary" in contents { if "summary" in contents {
section(title:"", { section(
title: "",
{
contents.summary.at(lang) 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 { if "education" in contents {
let title = sel_word_lang(en:"Education", de:"Ausbildung") let title = sel_word_lang(en: "Education", de: "Ausbildung")
section(title: title, entries:contents.thesis + contents.education)[] section(title: title, entries: contents.thesis + contents.education)[]
} }
if not use_sidebar { if not use_sidebar {
if "volunteering" in contents { if "volunteering" in contents {
let title = sel_word_lang(en:"Volunteer Work", de:"Ehrenamt") let title = sel_word_lang(en: "Volunteer Work", de: "Ehrenamt")
section(title: title, entries:contents.volunteering)[] section(title: title, entries: contents.volunteering)[]
} }
if "skills" in contents { if "skills" in contents {
let title = sel_word_lang(en:"Qualifications", de:"Qualifikationen") let title = sel_word_lang(en: "Qualifications", de: "Qualifikationen")
section(title: title, { section(
skill_item(item:contents.skills) title: title,
}) {
skill_item(item: contents.skills)
},
)
} }
if "languages" in contents { if "languages" in contents {
let title = sel_word_lang(en:"Languages", de:"Sprachen") let title = sel_word_lang(en: "Languages", de: "Sprachen")
section(title: title, { section(
skill_item(item:contents.languages) title: title,
}) {
skill_item(item: contents.languages)
},
)
} }
} }
} }
let sidebar = { let sidebar = {
if "volunteering" in contents { if "volunteering" in contents {
let title = sel_word_lang(en:"Volunteer Work", de:"Ehrenamt") let title = sel_word_lang(en: "Volunteer Work", de: "Ehrenamt")
[== #title] [== #title]
for e in contents.volunteering { for e in contents.volunteering {
[ [
@ -217,16 +238,16 @@
} }
if "languages" in contents { if "languages" in contents {
let title = sel_word_lang(en:"Languages", de:"Sprachen") let title = sel_word_lang(en: "Languages", de: "Sprachen")
[== #title] [== #title]
skill_item(item:contents.languages, is_sidebar: true) skill_item(item: contents.languages, is_sidebar: true)
[\ ] [\ ]
} }
if "skills" in contents { if "skills" in contents {
let title = sel_word_lang(en:"Qualifications", de:"Kenntnisse") let title = sel_word_lang(en: "Qualifications", de: "Kenntnisse")
[== #title] [== #title]
skill_item(item:contents.skills, is_sidebar: true) skill_item(item: contents.skills, is_sidebar: true)
} }
} }
@ -237,7 +258,12 @@
let margin = 1pt let margin = 1pt
grid( grid(
columns: (2fr, 1fr), columns: (2fr, 1fr),
block(outset: 0pt, inset: (top: 0.4 * margin, right: 0pt, rest: margin), stroke: none, width: 100%, { block(
outset: 0pt,
inset: (top: 0.4 * margin, right: 0pt, rest: margin),
stroke: none,
width: 100%,
{
set block(above: 10pt) set block(above: 10pt)
show heading.where(level: 1): it => style(s => { show heading.where(level: 1): it => style(s => {
let h = text(size: 18pt, upper(it)) let h = text(size: 18pt, upper(it))
@ -249,12 +275,13 @@
dy: 7pt, dy: 7pt,
dx: 10pt, dx: 10pt,
horizon + left, horizon + left,
line(stroke: accent-color, length: 100% - dim.width - 10pt) line(stroke: accent-color, length: 100% - dim.width - 10pt),
), ),
) )
}) })
body body
}), },
),
{ {
v(20pt) v(20pt)
set block(inset: (left: 20 * margin, right: 20 * margin)) set block(inset: (left: 20 * margin, right: 20 * margin))
@ -265,12 +292,9 @@
align(right, block(it)) align(right, block(it))
} }
sidebar sidebar
} },
) )
} }
#cv.with(use_sidebar: false)( #cv.with(use_sidebar: false)(yaml("content.yml"))
yaml("content.yml")
)

View file

@ -17,7 +17,7 @@
"en" "en"
} }
} }
#let sel_word_lang(de: "", en:"") = { #let sel_word_lang(de: "", en: "") = {
if lang == "de" { if lang == "de" {
de de
} else { } else {
@ -40,35 +40,36 @@
} }
#let header(about, columns: (1.5fr, 1fr, 1fr)) = { #let header(about, columns: (1.5fr, 1fr, 1fr)) = {
[= #about.fullname]; [= #about.fullname]
let contact_fields = (for c in about.contact { let contact_fields = (
for c in about.contact {
if "link" in c { if "link" in c {
([#c.icon ~ #link(c.link)[#c.text]],) ([#c.icon ~ #link(c.link)[#c.text]],)
} else { } else {
([#c.icon ~ #c.text],) ([#c.icon ~ #c.text],)
} }
}) }
)
grid( grid(
columns: columns, columns: columns,
gutter: 5pt, gutter: 5pt,
..contact_fields ..contact_fields
); )
} }
#let subdued(body) = { #let subdued(body) = {
block(inset: 5%, width: 85%, text(fill:luma(150), body)) block(inset: 5%, width: 85%, text(fill: luma(150), body))
} }
#let by_client(experience:()) = { #let by_client(experience: ()) = {
let by_client = (:) let by_client = (:)
for item in experience { for item in experience {
let client = item.place.at(lang) let client = item.place.at(lang)
if client not in by_client { if client not in by_client {
by_client.insert(client, ()) by_client.insert(client, ())
} }
by_client.at(client).push( (item.title.at(lang), item.date.at(lang)) ) by_client.at(client).push((item.title.at(lang), item.date.at(lang)))
} }
for (client, jobs) in by_client { for (client, jobs) in by_client {
@ -79,18 +80,17 @@
} }
} }
#let by_experience_type(type:(), experience:()) = { #let by_experience_type(type: (), experience: ()) = {
let by_ty = (:) let by_ty = (:)
for (id, desc) in type { for (id, desc) in type {
let matching_exp_items = (); let matching_exp_items = ()
// for item in experience { // for item in experience {
// [itemtypeid: #item.typeid, id: #id] // [itemtypeid: #item.typeid, id: #id]
// if item.typeid == id { // if item.typeid == id {
// matching_exp_items.push(item) // matching_exp_items.push(item)
// } // }
// } // }
let matching_exp_items = experience.filter(item => let matching_exp_items = experience.filter(item => int(item.typeid) == int(id))
int(item.typeid) == int(id))
[=== _#desc.at(lang)_] [=== _#desc.at(lang)_]
by_client(experience: matching_exp_items) by_client(experience: matching_exp_items)
} }
@ -117,21 +117,28 @@
} }
if "publication" in item { if "publication" in item {
subdued[#item.publication.at(lang) \ ] subdued[#item.publication.at(lang) \ ]
}; }
if "abstract" in item { if "abstract" in item {
subdued[#item.abstract.at(lang) \ ] subdued[#item.abstract.at(lang) \ ]
} }
} }
#let horizon_line() = {v(-3pt); line(length: 100%); v(-5pt)} #let horizon_line() = {
v(-3pt)
line(length: 100%)
v(-5pt)
}
#let section_header(title) = {[== #title]; horizon_line()}; #let section_header(title) = {
[== #title]
horizon_line()
};
#let section(title: "Section", entries: (), body) = { #let section(title: "Section", entries: (), body) = {
section_header(title); section_header(title)
if body == none or body == [] { if body == none or body == [] {
for e in entries { for e in entries {
entry(item:e) entry(item: e)
} }
} else { } else {
body body
@ -140,26 +147,29 @@
// Slightly re-styled entry with PLACE first and TITLE second // Slightly re-styled entry with PLACE first and TITLE second
#let education_entry(item: ()) = { #let education_entry(item: ()) = {
assert("place" in item and "title" in item and "date" in item, message: "Education items require place, program and date."); assert(
[*#item.place.at(lang)*, #item.title.at(lang) #h(1fr)]; "place" in item and "title" in item and "date" in item,
[ _#item.date.at(lang)_ \ ]; message: "Education items require place, program and date.",
)
[*#item.place.at(lang)*, #item.title.at(lang) #h(1fr)]
[ _#item.date.at(lang)_ \ ]
} }
// Restyled entry with PLACE not emphasized like usual, and no date but an abstract // Restyled entry with PLACE not emphasized like usual, and no date but an abstract
#let thesis_entry(item: ()) = { #let thesis_entry(item: ()) = {
assert("title" in item and "place" in item, message: "Thesis items require type and title."); assert("title" in item and "place" in item, message: "Thesis items require type and title.")
[*#item.title.at(lang)* #item.place.at(lang) #h(1fr)]; [*#item.title.at(lang)* #item.place.at(lang) #h(1fr)]
[#par(item.abstract.at(lang))] [#par(item.abstract.at(lang))]
} }
// skill-specific entry, changing its style for sidebar // skill-specific entry, changing its style for sidebar
#let skill_item(item: (), is_sidebar: false) = { #let skill_item(item: (), is_sidebar: false) = {
let side_list(body) = if is_sidebar {list(body)} else {par(body)} let side_list(body) = if is_sidebar { list(body) } else { par(body) }
for skill in item { for skill in item {
side_list({ side_list({
[*#skill.name.at(lang)*] [*#skill.name.at(lang)*]
if is_sidebar [\ ] else [ (] if is_sidebar [\ ] else [ (]
for (i,v) in skill.items.enumerate() { for (i, v) in skill.items.enumerate() {
[#v.at(lang)] [#v.at(lang)]
if i < skill.items.len() - 1 { if i < skill.items.len() - 1 {
[, ] [, ]
@ -204,45 +214,54 @@
let body = { let body = {
if "summary" in main and "summary" in contents { if "summary" in main and "summary" in contents {
section(title:"", { section(
title: "",
{
contents.summary.at(lang) contents.summary.at(lang)
}) },
)
} }
if "experience" in main and "experience" in contents { if "experience" in main and "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)[] section(title: title)[]
by_experience_type(experience: contents.experience, type: contents.experience_types) by_experience_type(experience: contents.experience, type: contents.experience_types)
} }
if "education" in main and "education" in contents { if "education" in main and "education" in contents {
let title = sel_word_lang(en:"Education", de:"Ausbildung") let title = sel_word_lang(en: "Education", de: "Ausbildung")
section(title: title, entries:contents.thesis + contents.education)[] section(title: title, entries: contents.thesis + contents.education)[]
} }
if "volunteering" in main and "volunteering" in contents { if "volunteering" in main and "volunteering" in contents {
let title = sel_word_lang(en:"Volunteer Work", de:"Ehrenamt") let title = sel_word_lang(en: "Volunteer Work", de: "Ehrenamt")
section(title: title, entries:contents.volunteering)[] section(title: title, entries: contents.volunteering)[]
} }
if "skills" in main and "skills" in contents { if "skills" in main and "skills" in contents {
let title = sel_word_lang(en:"Qualifications", de:"Qualifikationen") let title = sel_word_lang(en: "Qualifications", de: "Qualifikationen")
section(title: title, { section(
skill_item(item:contents.skills) title: title,
}) {
skill_item(item: contents.skills)
},
)
} }
if "languages" in main and "languages" in contents { if "languages" in main and "languages" in contents {
let title = sel_word_lang(en:"Languages", de:"Sprachen") let title = sel_word_lang(en: "Languages", de: "Sprachen")
section(title: title, { section(
skill_item(item:contents.languages) title: title,
}) {
skill_item(item: contents.languages)
},
)
} }
} }
let sidebar = { let sidebar = {
if "volunteering" in sidebar and "volunteering" in contents { if "volunteering" in sidebar and "volunteering" in contents {
let title = sel_word_lang(en:"Volunteer Work", de:"Ehrenamt") let title = sel_word_lang(en: "Volunteer Work", de: "Ehrenamt")
[== #title] [== #title]
for e in contents.at("volunteering") { for e in contents.at("volunteering") {
[ [
@ -253,23 +272,28 @@
} }
if "languages" in sidebar and "languages" in contents { if "languages" in sidebar and "languages" in contents {
let title = sel_word_lang(en:"Languages", de:"Sprachen") let title = sel_word_lang(en: "Languages", de: "Sprachen")
[== #title] [== #title]
skill_item(item:contents.languages, is_sidebar: true) skill_item(item: contents.languages, is_sidebar: true)
[\ ] [\ ]
} }
if "skills" in sidebar and "skills" in contents { if "skills" in sidebar and "skills" in contents {
let title = sel_word_lang(en:"Qualifications", de:"Kenntnisse") let title = sel_word_lang(en: "Qualifications", de: "Kenntnisse")
[== #title] [== #title]
skill_item(item:contents.skills, is_sidebar: true) skill_item(item: contents.skills, is_sidebar: true)
} }
} }
let margin = 1pt let margin = 1pt
grid( grid(
columns: (2fr, 1fr), columns: (2fr, 1fr),
block(outset: 0pt, inset: (top: 0.4 * margin, right: 0pt, rest: margin), stroke: none, width: 100%, { block(
outset: 0pt,
inset: (top: 0.4 * margin, right: 0pt, rest: margin),
stroke: none,
width: 100%,
{
set block(above: 10pt) set block(above: 10pt)
show heading.where(level: 1): it => style(s => { show heading.where(level: 1): it => style(s => {
let h = text(size: 18pt, upper(it)) let h = text(size: 18pt, upper(it))
@ -281,13 +305,18 @@
dy: 7pt, dy: 7pt,
dx: 10pt, dx: 10pt,
horizon + left, horizon + left,
line(stroke: accent-color, length: 100% - dim.width - 10pt) line(stroke: accent-color, length: 100% - dim.width - 10pt),
), ),
) )
}) })
body body
}), },
align(right, block(fill: luma(250), width: 90%, ),
align(
right,
block(
fill: luma(250),
width: 90%,
{ {
v(15pt) v(15pt)
set block(inset: (left: 20 * margin, right: 20 * margin)) set block(inset: (left: 20 * margin, right: 20 * margin))
@ -299,11 +328,10 @@
} }
sidebar sidebar
v(15pt) v(15pt)
})) },
),
),
) )
} }
#resume( #resume(yaml("content.yml"))
yaml("content.yml")
)