ref(resume): Move by_client and by_experience_type to lib

In the continuous process of moving everything away from the main resume
body, move these experience functions away.
This commit is contained in:
Marty Oehme 2025-03-18 14:57:57 +01:00
parent 37c59e71db
commit c831b008b9
Signed by: Marty
GPG key ID: 4E535BC19C61886E
2 changed files with 33 additions and 33 deletions

33
lib.typ
View file

@ -112,6 +112,39 @@
}
};
// TODO: make it _return_ the data, not display it on its own
#let by_client(experience: ()) = {
let by_client = (:)
for item in experience {
let client = item.place.at(lang)
if client not in by_client {
by_client.insert(client, ())
}
by_client.at(client).push((title: item.title.at(lang), date: item.date.at(lang)))
}
for (client, jobs) in by_client {
[*#client*:]
for j in jobs {
[- #j.title #h(1fr) #j.date]
}
}
}
#let by_experience_type(type: (), experience: ()) = {
let by_ty = (:)
for (id, desc) in type {
let matching_exp_items = experience.filter(item => int(item.typeid) == int(id))
if matching_exp_items.len() == 0 {
return
}
[=== _#desc.at(lang)_]
by_client(experience: matching_exp_items)
}
}
// Slightly re-styled entry with PLACE first and TITLE second
#let education_entry(item: ()) = {
assert(

View file

@ -1,38 +1,5 @@
#import "lib.typ": *
// TODO: make it _return_ the data, not display it on its own
#let by_client(experience: ()) = {
let by_client = (:)
for item in experience {
let client = item.place.at(lang)
if client not in by_client {
by_client.insert(client, ())
}
by_client.at(client).push((item.title.at(lang), item.date.at(lang)))
}
for (client, jobs) in by_client {
[*#client*:]
for j in jobs {
[- #j.at(0) #h(1fr) #j.at(1)]
}
}
}
#let by_experience_type(type: (), experience: ()) = {
let by_ty = (:)
for (id, desc) in type {
let matching_exp_items = experience.filter(item => int(item.typeid) == int(id))
if matching_exp_items.len() == 0 {
return
}
[=== _#desc.at(lang)_]
by_client(experience: matching_exp_items)
}
}
#let resume(contents, main: ("experience_by_type", "education"), sidebar: ("volunteering", "languages", "skills")) = {
show: style
show: smartypants