From 04a2267c9a4eb8aa6d63c1c1befbcec4a212c1fb Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Mon, 2 Dec 2024 00:08:45 +0300 Subject: [PATCH] context --- typst/decasify.typ | 4 ++-- typst/example.typ | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/typst/decasify.typ b/typst/decasify.typ index ec90bf5..4bce35b 100644 --- a/typst/decasify.typ +++ b/typst/decasify.typ @@ -5,8 +5,8 @@ str(_plugin.titlecase(bytes(s), bytes(l))) } -#let titlecase(body, locale, limit: 4) = { - show regex(".{" + str(limit) + ",}"): it => string-to-titlecase(it.text, locale) +#let titlecase(body, limit: 4) = { + show regex(".{" + str(limit) + ",}"): it => string-to-titlecase(it.text, text.lang) body } diff --git a/typst/example.typ b/typst/example.typ index ff58109..cf57d33 100644 --- a/typst/example.typ +++ b/typst/example.typ @@ -6,6 +6,8 @@ "first impluse", "ilk ışıltı", ) [ - #s → #titlecase(s, "en") \ - #s → #titlecase(s, "tr") \ + #set text(lang: "en") + (#context(text.lang)) #s → #titlecase(s) \ + #set text(lang: "tr") + (#context(text.lang)) #s → #titlecase(s) \ ]