diff --git a/lib.typ b/lib.typ index 2942d8f..d7f3a44 100644 --- a/lib.typ +++ b/lib.typ @@ -38,6 +38,23 @@ /// Helpers +// Common helper functions +#let __format_author_name(author, language) = { + if language == "zh" or language == "ja" { + str(author.firstname) + str(author.lastname) + } else { + str(author.firstname) + " " + str(author.lastname) + } +} + +#let __apply_smallcaps(content, use-smallcaps) = { + if use-smallcaps { + smallcaps(content) + } else { + content + } +} + // layout utility #let __justify_align(left_body, right_body) = { block[ @@ -70,23 +87,21 @@ ] } -#let __coverletter_footer(author, language, date, lang_data) = { +#let __coverletter_footer(author, language, date, lang_data, use-smallcaps: true) = { set text( fill: gray, size: 8pt, ) __justify_align_3[ - #smallcaps[#date] + #__apply_smallcaps(date, use-smallcaps) ][ - #smallcaps[ - #if language == "zh" or language == "ja" [ - #author.firstname#author.lastname - ] else [ - #author.firstname#sym.space#author.lastname - ] - #sym.dot.c - #linguify("cover-letter", from: lang_data) - ] + #__apply_smallcaps( + { + let name = __format_author_name(author, language) + name + " · " + linguify("cover-letter", from: lang_data) + }, + use-smallcaps + ) ][ #context { counter(page).display() @@ -94,23 +109,21 @@ ] } -#let __resume_footer(author, language, lang_data, date) = { +#let __resume_footer(author, language, lang_data, date, use-smallcaps: true) = { set text( fill: gray, size: 8pt, ) __justify_align_3[ - #smallcaps[#date] + #__apply_smallcaps(date, use-smallcaps) ][ - #smallcaps[ - #if language == "zh" or language == "ja" [ - #author.firstname#author.lastname - ] else [ - #author.firstname#sym.space#author.lastname - ] - #sym.dot.c - #linguify("resume", from: lang_data) - ] + #__apply_smallcaps( + { + let name = __format_author_name(author, language) + name + " · " + linguify("resume", from: lang_data) + }, + use-smallcaps + ) ][ #context { counter(page).display() @@ -195,6 +208,7 @@ /// - accent-color (color): The accent color of the resume /// - colored-headers (boolean): Whether the headers should be colored or not /// - language (string): The language of the resume, defaults to "en". See lang.toml for available languages +/// - use-smallcaps (boolean): Whether to use small caps formatting throughout the template /// - body (content): The body of the resume /// -> none #let resume( @@ -208,6 +222,7 @@ font: ("Source Sans Pro", "Source Sans 3"), header-font: ("Roboto"), paper-size: "a4", + use-smallcaps: true, body, ) = { if type(accent-color) == "string" { @@ -240,6 +255,7 @@ language, lang_data, date, + use-smallcaps: use-smallcaps, )] else [], footer-descent: 0pt, ) @@ -286,7 +302,7 @@ size: 10pt, weight: "regular", ) - smallcaps[#it.body] + __apply_smallcaps(it.body, use-smallcaps) } let name = { @@ -319,11 +335,12 @@ weight: "regular", ) align(center)[ - #smallcaps[ - #author.positions.join( + #__apply_smallcaps( + author.positions.join( text[#" "#sym.dot.c#" "], - ) - ] + ), + use-smallcaps + ) ] } @@ -576,6 +593,7 @@ /// - font (array): The font families of the cover letter /// - show-footer (boolean): Whether to show the footer or not /// - closing (content): The closing of the cover letter. This defaults to "Attached Curriculum Vitae". You can set this to `none` to show the default closing or remove it completely. +/// - use-smallcaps (boolean): Whether to use small caps formatting throughout the template /// - body (content): The body of the cover letter #let coverletter( author: (:), @@ -587,6 +605,7 @@ show-footer: true, closing: none, paper-size: "a4", + use-smallcaps: true, body, ) = { if type(accent-color) == "string" { @@ -624,6 +643,7 @@ language, date, lang_data, + use-smallcaps: use-smallcaps, )] else [], footer-descent: 0pt, ) @@ -686,11 +706,12 @@ weight: "regular", ) align(right)[ - #smallcaps[ - #author.positions.join( + #__apply_smallcaps( + author.positions.join( text[#" "#sym.dot.c#" "], - ) - ] + ), + use-smallcaps + ) ] } @@ -812,6 +833,7 @@ #let hiring-entity-info( entity-info: (:), date: datetime.today().display("[month repr:long] [day], [year]"), + use-smallcaps: true, ) = { set par(leading: 1em) pad(top: 1.5em, bottom: 1.5em)[ @@ -823,7 +845,7 @@ #pad(top: 0.65em, bottom: 0.65em)[ #text(weight: "regular", fill: color-gray, size: 9pt)[ - #smallcaps[#entity-info.name] \ + #__apply_smallcaps(entity-info.name, use-smallcaps) \ #entity-info.street-address \ #entity-info.city \ ]