From 5df8458b72b2db8a15fcacc16743ea1bc5df6973 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 17 Sep 2024 17:50:30 +0200 Subject: [PATCH] Add sidebar to document --- cv.typ | 179 ++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 126 insertions(+), 53 deletions(-) diff --git a/cv.typ b/cv.typ index 6db32f4..445986c 100644 --- a/cv.typ +++ b/cv.typ @@ -17,6 +17,13 @@ "en" } } +#let sel_word_lang(de: "", en:"") = { + if lang == "de" { + de + } else { + en + } +} #let _columns_3(left_body, center_body, right_body) = { block[ @@ -108,31 +115,34 @@ [#par(item.abstract.at(lang))] } -#let sel_word_lang(de: "", en:"") = { - if lang == "de" { - de - } else { - en - } -} - -// Old-style presentation of skills and qualifications, to be overhauled -#let skill_item(item: ()) = { - [*#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 { - [, ] +// skill-specific entry, changing its style for sidebar +#let skill_item(item: (), is_sidebar: false) = { + let side_list(body) = if is_sidebar {list(body)} else {par(body)} + for skill in item { + side_list({ + [*#skill.name.at(lang)*] + if is_sidebar [\ ] else [ (] + for (i,v) in skill.items.enumerate() { + [#v.at(lang)] + if i < skill.items.len() - 1 { + [, ] + } } - } - [) \ ] + if not is_sidebar [)] + }) } } -#let resume(contents) = { - // Feel free to change the margin below to best fit your own CV +#let cv(contents) = { + 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), @@ -142,14 +152,9 @@ size: 8pt, ) #_columns_3[ - #smallcaps[#datetime.today().display("[month repr:long] [day], [year]")] + #smallcaps[#datetime.today().display(date_formatting)] ][ - #smallcaps[ - // FIXME: Source from about.fullname variable - Marty Oehme - // #sym.dot.c - // CV - ] + #smallcaps[#contents.about.fullname] ][ #counter(page).display() ] @@ -160,38 +165,106 @@ header(contents.about) - if "summary" in contents { - section(title:"", { - contents.summary.at(lang) - }) - }; + let body = { + if "summary" in contents { + section(title:"", { + contents.summary.at(lang) + }) + }; - if "experience" in contents { - let title = sel_word_lang(en:"Professional Experience", de:"Berufserfahrung") - section(title: title, entries:contents.experience)[] + if "experience" in contents { + let title = sel_word_lang(en:"Professional Experience", de:"Berufserfahrung") + 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 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: "Qualifications", { - for cat in contents.skills { - skill_item(item:cat) + let sidebar = { + if "volunteering" in contents { + let title = sel_word_lang(en:"Volunteer Work", de:"Ehrenamt") + [== #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 = 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") )