From c831b008b93b9875646c7dd7c22b253eb4bc9b51 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 18 Mar 2025 14:57:57 +0100 Subject: [PATCH] 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. --- lib.typ | 33 +++++++++++++++++++++++++++++++++ resume.typ | 33 --------------------------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/lib.typ b/lib.typ index 09b33e1..c27d018 100644 --- a/lib.typ +++ b/lib.typ @@ -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( diff --git a/resume.typ b/resume.typ index 8309611..df2715a 100644 --- a/resume.typ +++ b/resume.typ @@ -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