diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-05-04 12:49:46 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-05-04 13:21:31 +0200 |
| commit | ba5622b7b90b23e61942a9f4e6460bf9ea0b4bc8 (patch) | |
| tree | 374c326c7375094f370165e47dbe24dd01f16c11 /src/library/utility | |
| parent | 507c5fc92563560426db0d86c0348880b0493467 (diff) | |
Move smallcaps into separate function
Diffstat (limited to 'src/library/utility')
| -rw-r--r-- | src/library/utility/string.rs | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/src/library/utility/string.rs b/src/library/utility/string.rs index 0b309b31..13a6bbd8 100644 --- a/src/library/utility/string.rs +++ b/src/library/utility/string.rs @@ -2,7 +2,6 @@ use lipsum::lipsum_from_seed; use crate::eval::Regex; use crate::library::prelude::*; -use crate::library::text::{Case, TextNode}; /// The string representation of a value. pub fn repr(_: &mut Context, args: &mut Args) -> TypResult<Value> { @@ -20,26 +19,6 @@ pub fn str(_: &mut Context, args: &mut Args) -> TypResult<Value> { })) } -/// Convert a string to lowercase. -pub fn lower(_: &mut Context, args: &mut Args) -> TypResult<Value> { - case(Case::Lower, args) -} - -/// Convert a string to uppercase. -pub fn upper(_: &mut Context, args: &mut Args) -> TypResult<Value> { - case(Case::Upper, args) -} - -/// Change the case of a string or content. -fn case(case: Case, args: &mut Args) -> TypResult<Value> { - let Spanned { v, span } = args.expect("string or content")?; - Ok(match v { - Value::Str(v) => Value::Str(case.apply(&v).into()), - Value::Content(v) => Value::Content(v.styled(TextNode::CASE, Some(case))), - v => bail!(span, "expected string or content, found {}", v.type_name()), - }) -} - /// Create blind text. pub fn lorem(_: &mut Context, args: &mut Args) -> TypResult<Value> { let words: usize = args.expect("number of words")?; |
