Filter language layout
parent
796e41ff9c
commit
da531343f0
82
cv/cv.typ
82
cv/cv.typ
|
|
@ -62,7 +62,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// address
|
// address
|
||||||
#let addresstext(info, uservars) = {
|
#let addresstext(lang, info, uservars) = {
|
||||||
if uservars.showAddress {
|
if uservars.showAddress {
|
||||||
block(width: 100%)[
|
block(width: 100%)[
|
||||||
#info.personal.location.city, #info.personal.location.region, #info.personal.location.country
|
#info.personal.location.city, #info.personal.location.region, #info.personal.location.country
|
||||||
|
|
@ -77,11 +77,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#let contacttext(info, uservars) = block(width: 100%)[
|
#let contacttext(lang, info, uservars) = block(width: 100%)[
|
||||||
#let profiles = (
|
#let profiles = (
|
||||||
box(link("mailto:" + info.personal.email)[#fa(" ") #info.personal.email]),
|
box(link("mailto:" + info.personal.email)[#fa(" ") #info.personal.email]),
|
||||||
if uservars.showNumber {box(link("tel:" + info.personal.phone)[#fa("") #info.personal.phone])} else {none},
|
if uservars.showNumber {box(link("tel:" + info.personal.phone)[#fa("") #info.personal.phone])} else {none},
|
||||||
if info.personal.url != none {
|
if info.personal.at("url", default: none) != none {
|
||||||
box(link(info.personal.url)[#fa(" ") #info.personal.url.split("//").at(1)])
|
box(link(info.personal.url)[#fa(" ") #info.personal.url.split("//").at(1)])
|
||||||
}
|
}
|
||||||
).filter(it => it != none) // filter out none elements from the profile array
|
).filter(it => it != none) // filter out none elements from the profile array
|
||||||
|
|
@ -100,25 +100,23 @@
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
#let cvheading(info, uservars) = {
|
#let cvheading(lang, info, uservars) = {
|
||||||
align(center)[
|
align(center)[
|
||||||
= #info.personal.name
|
= #info.personal.name
|
||||||
#addresstext(info, uservars)
|
#addresstext(lang, info, uservars)
|
||||||
#contacttext(info, uservars)
|
#contacttext(lang, info, uservars)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
#let cvwork(lang, info, isbreakable: true) = {
|
#let cvwork(lang, info, isbreakable: true) = {
|
||||||
if info.experience != none {block[
|
if info.experience != none {block[
|
||||||
== #utils.getWithLang(lang, info.experience.title)
|
== #info.experience.title
|
||||||
#for w in info.experience.content {
|
#for w in info.experience.content {
|
||||||
let wwith = utils.getWithLang(lang, w.with)
|
|
||||||
let wwhere = utils.getWithLang(lang, w.where)
|
|
||||||
block(width: 100%, breakable: isbreakable)[
|
block(width: 100%, breakable: isbreakable)[
|
||||||
#if w.url != none [
|
#if w.url != none [
|
||||||
*#link(utils.getWithLang(lang, w.url))[#wwith]* #h(1fr) *#wwhere* \
|
*#link(w.url)[#w.with]* #h(1fr) *#w.where* \
|
||||||
] else [
|
] else [
|
||||||
*#wwith* #h(1fr) *#wwhere* \
|
*#w.with* #h(1fr) *#w.where* \
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
// create a block layout for each work entry
|
// create a block layout for each work entry
|
||||||
|
|
@ -130,11 +128,11 @@
|
||||||
#let start = utils.strpdate(lang, p.startDate)
|
#let start = utils.strpdate(lang, p.startDate)
|
||||||
#let end = utils.strpdate(lang, p.endDate)
|
#let end = utils.strpdate(lang, p.endDate)
|
||||||
// line 2: position and date range
|
// line 2: position and date range
|
||||||
#text(style: "italic")[#utils.getWithLang(lang, p.what)] #h(1fr)
|
#text(style: "italic")[#p.what] #h(1fr)
|
||||||
#start #sym.dash.en #end \
|
#start #sym.dash.en #end \
|
||||||
// highlights or description
|
// highlights or description
|
||||||
#for hi in utils.getWithLang(lang, p.why) [
|
#for hi in p.why [
|
||||||
- #eval(utils.getWithLang(lang, hi), mode: "markup")
|
- #eval(hi, mode: "markup")
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
index = index + 1
|
index = index + 1
|
||||||
|
|
@ -144,34 +142,29 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#let cveducation(lang, info, isbreakable: true) = {
|
#let cveducation(lang, info, isbreakable: true) = {
|
||||||
if info.education != none {block[
|
let education = info.education
|
||||||
== Education
|
if education != none {block[
|
||||||
#for edu in info.education {
|
== #education.title
|
||||||
|
#for edu in education.content {
|
||||||
let start = utils.strpdate(lang, edu.startDate)
|
let start = utils.strpdate(lang, edu.startDate)
|
||||||
let end = utils.strpdate(lang, edu.endDate)
|
let end = utils.strpdate(lang, edu.endDate)
|
||||||
|
let eduurl = edu.at("url", default: none)
|
||||||
let edu-items = ""
|
|
||||||
if edu.honors != none {edu-items = edu-items + "- *Honors*: " + edu.honors.join(", ") + "\n"}
|
|
||||||
if edu.why != none {edu-items = edu-items + "- *Courses*: " + edu.why.join(", ") + "\n"}
|
|
||||||
if edu.highlights != none {
|
|
||||||
for hi in edu.highlights {
|
|
||||||
edu-items = edu-items + "- " + hi + "\n"
|
|
||||||
}
|
|
||||||
edu-items = edu-items.trim("\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a block layout for each education entry
|
// create a block layout for each education entry
|
||||||
block(width: 100%, breakable: isbreakable)[
|
block(width: 100%, breakable: isbreakable)[
|
||||||
// line 1: institution and location
|
// line 1: institution and location
|
||||||
#if edu.url != none [
|
#if eduurl != none [
|
||||||
*#link(edu.url)[#edu.with]* #h(1fr) *#edu.what* \
|
*#link(eduurl)[#edu.with]* #h(1fr) *#edu.where* \
|
||||||
] else [
|
] else [
|
||||||
*#edu.with* #h(1fr) *#edu.what* \
|
*#edu.with* #h(1fr) *#edu.where* \
|
||||||
]
|
]
|
||||||
// line 2: degree and date
|
// line 2: degree and date
|
||||||
#text(style: "italic")[#edu.what] #h(1fr)
|
#text(style: "italic")[#edu.what] #h(1fr)
|
||||||
#start #sym.dash.en #end \
|
#start #sym.dash.en #end \
|
||||||
#eval(edu-items, mode: "markup")
|
|
||||||
|
#for hi in edu.why [
|
||||||
|
- #eval(hi, mode: "markup")
|
||||||
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
|
|
@ -303,25 +296,14 @@
|
||||||
]}
|
]}
|
||||||
}
|
}
|
||||||
|
|
||||||
#let cvskills(info, isbreakable: true) = {
|
#let cvskills(lang, info, isbreakable: true) = {
|
||||||
if (info.languages != none) or (info.skills != none) or (info.interests != none) {block(breakable: isbreakable)[
|
block(breakable: isbreakable)[
|
||||||
== Skills, Languages, Interests
|
== #info.skills.title
|
||||||
#if (info.languages != none) [
|
|
||||||
#let langs = ()
|
#for skill in info.skills.content {
|
||||||
#for lang in info.languages {
|
[- *#skill.title*]
|
||||||
langs.push([#lang.language (#lang.fluency)])
|
}
|
||||||
}
|
]
|
||||||
- *Languages*: #langs.join(", ")
|
|
||||||
]
|
|
||||||
#if (info.skills != none) [
|
|
||||||
#for group in info.skills [
|
|
||||||
- *#group.category*: #group.skills.join(", ")
|
|
||||||
]
|
|
||||||
]
|
|
||||||
#if (info.interests != none) [
|
|
||||||
- *Interests*: #info.interests.join(", ")
|
|
||||||
]
|
|
||||||
]}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#let cvreferences(info, isbreakable: true) = {
|
#let cvreferences(info, isbreakable: true) = {
|
||||||
|
|
|
||||||
65
cv/utils.typ
65
cv/utils.typ
|
|
@ -1,6 +1,5 @@
|
||||||
#let months = yaml("../data/months.yaml")
|
#let months = yaml("../data/months.yaml")
|
||||||
|
|
||||||
|
|
||||||
#let getWithLang(lang, data) = {
|
#let getWithLang(lang, data) = {
|
||||||
if type(data) == dictionary {
|
if type(data) == dictionary {
|
||||||
data.at(lang)
|
data.at(lang)
|
||||||
|
|
@ -9,34 +8,52 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#let display = getWithLang("fr", months.at("short")).at(1)
|
|
||||||
|
|
||||||
// Helper Functions
|
// Helper Functions
|
||||||
#let monthname(lang, n, display: "short") = {
|
#let monthname(lang, n, display: "short") = {
|
||||||
n = int(n)
|
n = int(n)
|
||||||
let month = ""
|
let month = ""
|
||||||
|
|
||||||
let displayMonths = getWithLang(lang, months.at(display))
|
let displayMonths = getWithLang(lang, months.at(display))
|
||||||
|
|
||||||
if (n > 0 and n <= 12) {
|
if (n > 0 and n <= 12) {
|
||||||
month = displayMonths.at(n - 1)
|
month = displayMonths.at(n - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
month
|
month
|
||||||
}
|
}
|
||||||
|
|
||||||
#let strpdate(lang, isodate) = {
|
#let strpdate(lang, isodate) = {
|
||||||
let date = ""
|
let date = ""
|
||||||
let isodate = getWithLang(lang, isodate)
|
let isodate = getWithLang(lang, isodate)
|
||||||
if (regex("\d{4}-\d{2}-\d{2}") in isodate) {
|
if (regex("\d{4}-\d{2}-\d{2}") in isodate) {
|
||||||
date = datetime(
|
date = datetime(
|
||||||
year: int(isodate.slice(0, 4)),
|
year: int(isodate.slice(0, 4)),
|
||||||
month: int(isodate.slice(5, 7)),
|
month: int(isodate.slice(5, 7)),
|
||||||
day: int(isodate.slice(8, 10))
|
day: int(isodate.slice(8, 10)),
|
||||||
)
|
)
|
||||||
date = monthname(lang, date.month()) + " " + date.display("[year repr:full]")
|
date = monthname(lang, date.month()) + " " + date.display("[year repr:full]")
|
||||||
} else {
|
} else {
|
||||||
date = isodate
|
date = isodate
|
||||||
}
|
}
|
||||||
return date
|
return date
|
||||||
|
}
|
||||||
|
|
||||||
|
#let filterLanguage(lang, data) = {
|
||||||
|
if type(data) == dictionary {
|
||||||
|
if data.at(lang, default: none) == none {
|
||||||
|
data = data
|
||||||
|
.pairs()
|
||||||
|
.map(xs => (xs.first(), filterLanguage(lang, xs.last())))
|
||||||
|
.fold((:), (acc, xs) => {
|
||||||
|
acc.insert(xs.first(), xs.last())
|
||||||
|
acc
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
data = filterLanguage(lang, data.at(lang))
|
||||||
|
}
|
||||||
|
} else if type(data) == array {
|
||||||
|
data = data.map(v => filterLanguage(lang, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
data
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue