decasify 0.6.1__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {decasify-0.6.1 → decasify-0.7.0}/Cargo.lock +1 -1
- {decasify-0.6.1 → decasify-0.7.0}/Cargo.toml +1 -1
- {decasify-0.6.1 → decasify-0.7.0}/PKG-INFO +10 -10
- {decasify-0.6.1 → decasify-0.7.0}/README.md +9 -9
- {decasify-0.6.1 → decasify-0.7.0}/src/bin/decasify.rs +12 -11
- {decasify-0.6.1 → decasify-0.7.0}/src/cli.rs +7 -7
- {decasify-0.6.1 → decasify-0.7.0}/src/content.rs +14 -12
- {decasify-0.6.1 → decasify-0.7.0}/src/lib.rs +86 -75
- {decasify-0.6.1 → decasify-0.7.0}/src/lua.rs +17 -18
- {decasify-0.6.1 → decasify-0.7.0}/src/python.rs +7 -7
- {decasify-0.6.1 → decasify-0.7.0}/src/types.rs +41 -12
- {decasify-0.6.1 → decasify-0.7.0}/src/wasm.rs +5 -9
- decasify-0.6.1/fibby/bin/decasify.rs +0 -54
- decasify-0.6.1/fibby/lib/luarocks/rocks-5.4/decasify.nvim/dev-1/bin/decasify.rs +0 -54
- decasify-0.6.1/t/debug/build/unicode_titlecase-16618a8ffa363649/out/casing.rs +0 -1481
- decasify-0.6.1/t/release/build/unicode_titlecase-b9387febdd3ed11b/out/casing.rs +0 -1481
- {decasify-0.6.1 → decasify-0.7.0}/build-aux/build.rs +0 -0
- {decasify-0.6.1 → decasify-0.7.0}/pyproject.toml +0 -0
- {decasify-0.6.1 → decasify-0.7.0}/tests/cli.rs +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: decasify
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Classifier: Development Status :: 5 - Production/Stable
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: Natural Language :: English
|
|
@@ -123,21 +123,21 @@ In your `Cargo.toml` file.
|
|
|
123
123
|
|
|
124
124
|
```toml
|
|
125
125
|
[dependencies]
|
|
126
|
-
decasify = "0.
|
|
126
|
+
decasify = "0.7"
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
Then use the crate functions and types in your project something like this:
|
|
130
130
|
|
|
131
131
|
```rust
|
|
132
132
|
use decasify::to_titlecase;
|
|
133
|
-
use decasify::{
|
|
133
|
+
use decasify::{Locale, StyleGuide};
|
|
134
134
|
|
|
135
135
|
fn demo() {
|
|
136
136
|
let input = "ILIK SU VE İTEN RÜZGARLAR";
|
|
137
|
-
let output = to_titlecase(input,
|
|
137
|
+
let output = to_titlecase(input, Locale::TR, StyleGuide::LanguageDefault);
|
|
138
138
|
eprintln! {"{output}"};
|
|
139
139
|
let input = "title with a twist: a colon";
|
|
140
|
-
let output = to_titlecase(input,
|
|
140
|
+
let output = to_titlecase(input, Locale::EN, StyleGuide::DaringFireball);
|
|
141
141
|
eprintln! {"{output}"};
|
|
142
142
|
}
|
|
143
143
|
```
|
|
@@ -181,10 +181,10 @@ Then import and use the provided functions and type classes:
|
|
|
181
181
|
from decasify import *
|
|
182
182
|
|
|
183
183
|
input = "ILIK SU VE İTEN RÜZGARLAR"
|
|
184
|
-
output = titlecase(input,
|
|
184
|
+
output = titlecase(input, Locale.TR)
|
|
185
185
|
print(output)
|
|
186
186
|
input = "title with a twist: a colon"
|
|
187
|
-
output = titlecase(input,
|
|
187
|
+
output = titlecase(input, Locale.EN, StyleGuide.DaringFireball)
|
|
188
188
|
print(output)
|
|
189
189
|
```
|
|
190
190
|
|
|
@@ -195,14 +195,14 @@ Depend on the WASM based JavaScript module in your project with `npm add decasif
|
|
|
195
195
|
Then import and use the provided functions and classes:
|
|
196
196
|
|
|
197
197
|
```javascript
|
|
198
|
-
import { titlecase, uppercase, lowercase,
|
|
198
|
+
import { titlecase, uppercase, lowercase, Locale, StyleGuide } from 'decasify';
|
|
199
199
|
|
|
200
200
|
var input = "ILIK SU VE İTEN RÜZGARLAR"
|
|
201
|
-
var output = titlecase(input,
|
|
201
|
+
var output = titlecase(input, Locale.TR)
|
|
202
202
|
console.log(output)
|
|
203
203
|
|
|
204
204
|
var input = "title with a twist: a colon"
|
|
205
|
-
var output = titlecase(input,
|
|
205
|
+
var output = titlecase(input, Locale.EN, StyleGuide.DaringFireball)
|
|
206
206
|
console.log(output)
|
|
207
207
|
```
|
|
208
208
|
|
|
@@ -101,21 +101,21 @@ In your `Cargo.toml` file.
|
|
|
101
101
|
|
|
102
102
|
```toml
|
|
103
103
|
[dependencies]
|
|
104
|
-
decasify = "0.
|
|
104
|
+
decasify = "0.7"
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
Then use the crate functions and types in your project something like this:
|
|
108
108
|
|
|
109
109
|
```rust
|
|
110
110
|
use decasify::to_titlecase;
|
|
111
|
-
use decasify::{
|
|
111
|
+
use decasify::{Locale, StyleGuide};
|
|
112
112
|
|
|
113
113
|
fn demo() {
|
|
114
114
|
let input = "ILIK SU VE İTEN RÜZGARLAR";
|
|
115
|
-
let output = to_titlecase(input,
|
|
115
|
+
let output = to_titlecase(input, Locale::TR, StyleGuide::LanguageDefault);
|
|
116
116
|
eprintln! {"{output}"};
|
|
117
117
|
let input = "title with a twist: a colon";
|
|
118
|
-
let output = to_titlecase(input,
|
|
118
|
+
let output = to_titlecase(input, Locale::EN, StyleGuide::DaringFireball);
|
|
119
119
|
eprintln! {"{output}"};
|
|
120
120
|
}
|
|
121
121
|
```
|
|
@@ -159,10 +159,10 @@ Then import and use the provided functions and type classes:
|
|
|
159
159
|
from decasify import *
|
|
160
160
|
|
|
161
161
|
input = "ILIK SU VE İTEN RÜZGARLAR"
|
|
162
|
-
output = titlecase(input,
|
|
162
|
+
output = titlecase(input, Locale.TR)
|
|
163
163
|
print(output)
|
|
164
164
|
input = "title with a twist: a colon"
|
|
165
|
-
output = titlecase(input,
|
|
165
|
+
output = titlecase(input, Locale.EN, StyleGuide.DaringFireball)
|
|
166
166
|
print(output)
|
|
167
167
|
```
|
|
168
168
|
|
|
@@ -173,14 +173,14 @@ Depend on the WASM based JavaScript module in your project with `npm add decasif
|
|
|
173
173
|
Then import and use the provided functions and classes:
|
|
174
174
|
|
|
175
175
|
```javascript
|
|
176
|
-
import { titlecase, uppercase, lowercase,
|
|
176
|
+
import { titlecase, uppercase, lowercase, Locale, StyleGuide } from 'decasify';
|
|
177
177
|
|
|
178
178
|
var input = "ILIK SU VE İTEN RÜZGARLAR"
|
|
179
|
-
var output = titlecase(input,
|
|
179
|
+
var output = titlecase(input, Locale.TR)
|
|
180
180
|
console.log(output)
|
|
181
181
|
|
|
182
182
|
var input = "title with a twist: a colon"
|
|
183
|
-
var output = titlecase(input,
|
|
183
|
+
var output = titlecase(input, Locale.EN, StyleGuide.DaringFireball)
|
|
184
184
|
console.log(output)
|
|
185
185
|
```
|
|
186
186
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
use decasify::cli::Cli;
|
|
5
5
|
use decasify::{to_lowercase, to_sentencecase, to_titlecase, to_uppercase};
|
|
6
|
-
use decasify::{
|
|
6
|
+
use decasify::{Case, Locale, Result, StyleGuide};
|
|
7
7
|
|
|
8
8
|
use clap::CommandFactory;
|
|
9
9
|
use std::io;
|
|
@@ -13,9 +13,9 @@ fn main() -> Result<()> {
|
|
|
13
13
|
let version = option_env!("VERGEN_GIT_DESCRIBE").unwrap_or_else(|| env!("CARGO_PKG_VERSION"));
|
|
14
14
|
let app = Cli::command().version(version);
|
|
15
15
|
let matches = app.get_matches();
|
|
16
|
-
let locale = matches.get_one::<
|
|
17
|
-
let case = matches.get_one::<
|
|
18
|
-
let style = matches.get_one::<StyleGuide>("style").
|
|
16
|
+
let locale = matches.get_one::<Locale>("locale").unwrap();
|
|
17
|
+
let case = matches.get_one::<Case>("case").unwrap().to_owned();
|
|
18
|
+
let style = matches.get_one::<StyleGuide>("style").unwrap().to_owned();
|
|
19
19
|
match matches.contains_id("input") {
|
|
20
20
|
true => {
|
|
21
21
|
let input: Vec<String> = matches
|
|
@@ -38,16 +38,17 @@ fn main() -> Result<()> {
|
|
|
38
38
|
|
|
39
39
|
fn process<I: IntoIterator<Item = String>>(
|
|
40
40
|
strings: I,
|
|
41
|
-
locale:
|
|
42
|
-
case:
|
|
43
|
-
style:
|
|
41
|
+
locale: Locale,
|
|
42
|
+
case: Case,
|
|
43
|
+
style: StyleGuide,
|
|
44
44
|
) {
|
|
45
45
|
for string in strings {
|
|
46
46
|
let output = match case {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
Case::Title => to_titlecase(string, locale, style),
|
|
48
|
+
Case::Lower => to_lowercase(string, locale),
|
|
49
|
+
Case::Upper => to_uppercase(string, locale),
|
|
50
|
+
Case::Sentence => to_sentencecase(string, locale),
|
|
51
|
+
_ => unreachable!(),
|
|
51
52
|
};
|
|
52
53
|
println!("{output}")
|
|
53
54
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: LGPL-3.0-only
|
|
3
3
|
|
|
4
4
|
#[cfg(build)]
|
|
5
|
-
use crate::{
|
|
5
|
+
use crate::{Case, Locale, StyleGuide};
|
|
6
6
|
|
|
7
7
|
use clap::{builder, Parser};
|
|
8
8
|
use strum::VariantNames;
|
|
@@ -21,16 +21,16 @@ macro_rules! clap_enum_variants {
|
|
|
21
21
|
#[clap(author, bin_name = "decasify")]
|
|
22
22
|
pub struct Cli {
|
|
23
23
|
/// Locale
|
|
24
|
-
#[clap(short, long, default_value_t, ignore_case = true, value_parser = clap_enum_variants!(
|
|
25
|
-
pub locale:
|
|
24
|
+
#[clap(short, long, default_value_t, ignore_case = true, value_parser = clap_enum_variants!(Locale))]
|
|
25
|
+
pub locale: Locale,
|
|
26
26
|
|
|
27
27
|
/// Target case
|
|
28
|
-
#[clap(short, long, default_value_t, ignore_case = true, value_parser = clap_enum_variants!(
|
|
29
|
-
pub case:
|
|
28
|
+
#[clap(short, long, default_value_t, ignore_case = true, value_parser = clap_enum_variants!(Case))]
|
|
29
|
+
pub case: Case,
|
|
30
30
|
|
|
31
31
|
/// Style Guide
|
|
32
|
-
#[clap(short, long, ignore_case = true, value_parser = clap_enum_variants!(StyleGuide))]
|
|
33
|
-
pub style:
|
|
32
|
+
#[clap(short, long, default_value_t, ignore_case = true, value_parser = clap_enum_variants!(StyleGuide))]
|
|
33
|
+
pub style: StyleGuide,
|
|
34
34
|
|
|
35
35
|
/// Input string
|
|
36
36
|
pub input: Vec<String>,
|
|
@@ -6,20 +6,22 @@ use regex::Regex;
|
|
|
6
6
|
use std::{borrow::Cow, error, fmt, fmt::Display, str::FromStr};
|
|
7
7
|
|
|
8
8
|
#[derive(Clone, Debug, PartialEq)]
|
|
9
|
+
#[non_exhaustive]
|
|
9
10
|
pub enum Segment {
|
|
10
11
|
Separator(String),
|
|
11
12
|
Word(String),
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
#[derive(Debug, Clone)]
|
|
16
|
+
#[non_exhaustive]
|
|
15
17
|
pub struct Chunk {
|
|
16
18
|
pub segments: Vec<Segment>,
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
fn split_chunk(
|
|
21
|
+
fn split_chunk(s: &str) -> Chunk {
|
|
20
22
|
let mut segments: Vec<Segment> = Vec::new();
|
|
21
23
|
let captures = Regex::new(r"(?<separator>\p{Whitespace}+)|(?<word>\P{Whitespace}+)").unwrap();
|
|
22
|
-
for capture in captures.captures_iter(
|
|
24
|
+
for capture in captures.captures_iter(s) {
|
|
23
25
|
if let Some(m) = capture.name("separator") {
|
|
24
26
|
segments.push(Segment::Separator(m.as_str().to_string()));
|
|
25
27
|
} else if let Some(m) = capture.name("word") {
|
|
@@ -30,33 +32,33 @@ fn split_chunk(src: &str) -> Chunk {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
impl From<String> for Chunk {
|
|
33
|
-
fn from(
|
|
34
|
-
split_chunk(
|
|
35
|
+
fn from(s: String) -> Self {
|
|
36
|
+
split_chunk(s.as_ref())
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
impl From<&String> for Chunk {
|
|
39
|
-
fn from(
|
|
40
|
-
split_chunk(
|
|
41
|
+
fn from(s: &String) -> Self {
|
|
42
|
+
split_chunk(s.as_ref())
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
impl From<&str> for Chunk {
|
|
45
|
-
fn from(
|
|
46
|
-
split_chunk(
|
|
47
|
+
fn from(s: &str) -> Self {
|
|
48
|
+
split_chunk(s)
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
impl From<&Cow<'_, str>> for Chunk {
|
|
51
|
-
fn from(
|
|
52
|
-
split_chunk(
|
|
53
|
+
fn from(s: &Cow<'_, str>) -> Self {
|
|
54
|
+
split_chunk(s)
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
impl FromStr for Chunk {
|
|
57
59
|
type Err = Box<dyn error::Error>;
|
|
58
|
-
fn from_str(
|
|
59
|
-
Ok(split_chunk(
|
|
60
|
+
fn from_str(s: &str) -> Result<Self> {
|
|
61
|
+
Ok(split_chunk(s))
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
|
|
@@ -12,7 +12,7 @@ pub mod content;
|
|
|
12
12
|
pub mod types;
|
|
13
13
|
|
|
14
14
|
pub use content::{Chunk, Segment};
|
|
15
|
-
pub use types::{
|
|
15
|
+
pub use types::{Case, Locale, Result, StyleGuide};
|
|
16
16
|
|
|
17
17
|
#[cfg(feature = "cli")]
|
|
18
18
|
pub mod cli;
|
|
@@ -29,52 +29,54 @@ pub mod wasm;
|
|
|
29
29
|
/// Convert a string to title case following typesetting conventions for a target locale
|
|
30
30
|
pub fn to_titlecase(
|
|
31
31
|
chunk: impl Into<Chunk>,
|
|
32
|
-
locale:
|
|
33
|
-
style:
|
|
32
|
+
locale: impl Into<Locale>,
|
|
33
|
+
style: impl Into<StyleGuide>,
|
|
34
34
|
) -> String {
|
|
35
35
|
let chunk: Chunk = chunk.into();
|
|
36
|
+
let locale: Locale = locale.into();
|
|
37
|
+
let style: StyleGuide = style.into();
|
|
36
38
|
match locale {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
Locale::EN => to_titlecase_en(chunk, style),
|
|
40
|
+
Locale::TR => to_titlecase_tr(chunk, style),
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/// Convert a string to lower case following typesetting conventions for a target locale
|
|
43
|
-
pub fn to_lowercase(chunk: impl Into<Chunk>, locale: impl Into<
|
|
45
|
+
pub fn to_lowercase(chunk: impl Into<Chunk>, locale: impl Into<Locale>) -> String {
|
|
44
46
|
let chunk: Chunk = chunk.into();
|
|
45
|
-
let locale:
|
|
47
|
+
let locale: Locale = locale.into();
|
|
46
48
|
match locale {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
Locale::EN => to_lowercase_en(chunk),
|
|
50
|
+
Locale::TR => to_lowercase_tr(chunk),
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
/// Convert a string to upper case following typesetting conventions for a target locale
|
|
53
|
-
pub fn to_uppercase(chunk: impl Into<Chunk>, locale: impl Into<
|
|
55
|
+
pub fn to_uppercase(chunk: impl Into<Chunk>, locale: impl Into<Locale>) -> String {
|
|
54
56
|
let chunk: Chunk = chunk.into();
|
|
55
|
-
let locale:
|
|
57
|
+
let locale: Locale = locale.into();
|
|
56
58
|
match locale {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
Locale::EN => to_uppercase_en(chunk),
|
|
60
|
+
Locale::TR => to_uppercase_tr(chunk),
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
/// Convert a string to sentence case following typesetting conventions for a target locale
|
|
63
|
-
pub fn to_sentencecase(chunk: impl Into<Chunk>, locale: impl Into<
|
|
65
|
+
pub fn to_sentencecase(chunk: impl Into<Chunk>, locale: impl Into<Locale>) -> String {
|
|
64
66
|
let chunk: Chunk = chunk.into();
|
|
65
|
-
let locale:
|
|
67
|
+
let locale: Locale = locale.into();
|
|
66
68
|
match locale {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
Locale::EN => to_sentencecase_en(chunk),
|
|
70
|
+
Locale::TR => to_sentencecase_tr(chunk),
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
fn to_titlecase_en(chunk: Chunk, style:
|
|
74
|
+
fn to_titlecase_en(chunk: Chunk, style: StyleGuide) -> String {
|
|
73
75
|
match style {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
StyleGuide::AssociatedPress => to_titlecase_ap(chunk),
|
|
77
|
+
StyleGuide::ChicagoManualOfStyle => to_titlecase_cmos(chunk),
|
|
78
|
+
StyleGuide::DaringFireball => to_titlecase_gruber(chunk),
|
|
79
|
+
StyleGuide::LanguageDefault => to_titlecase_gruber(chunk),
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
|
|
@@ -125,10 +127,9 @@ fn to_titlecase_gruber(chunk: Chunk) -> String {
|
|
|
125
127
|
format!("{}{}{}", leading_trivia, titilized, trailing_trivia)
|
|
126
128
|
}
|
|
127
129
|
|
|
128
|
-
fn to_titlecase_tr(chunk: Chunk, style:
|
|
130
|
+
fn to_titlecase_tr(chunk: Chunk, style: StyleGuide) -> String {
|
|
129
131
|
match style {
|
|
130
|
-
|
|
131
|
-
None => {
|
|
132
|
+
StyleGuide::LanguageDefault => {
|
|
132
133
|
let mut chunk = chunk.clone();
|
|
133
134
|
let mut done_first = false;
|
|
134
135
|
chunk.segments.iter_mut().for_each(|segment| {
|
|
@@ -146,6 +147,7 @@ fn to_titlecase_tr(chunk: Chunk, style: Option<StyleGuide>) -> String {
|
|
|
146
147
|
});
|
|
147
148
|
chunk.to_string()
|
|
148
149
|
}
|
|
150
|
+
_ => todo!("Turkish implementation doesn't support different style guides."),
|
|
149
151
|
}
|
|
150
152
|
}
|
|
151
153
|
|
|
@@ -244,6 +246,24 @@ fn to_sentencecase_tr(chunk: Chunk) -> String {
|
|
|
244
246
|
mod tests {
|
|
245
247
|
use super::*;
|
|
246
248
|
|
|
249
|
+
#[test]
|
|
250
|
+
fn cast_from_str() {
|
|
251
|
+
let res = to_titlecase("FIST", "en", "gruber");
|
|
252
|
+
assert_eq!(res, "Fist");
|
|
253
|
+
let res = to_titlecase("FIST", "tr", "");
|
|
254
|
+
assert_eq!(res, "Fıst");
|
|
255
|
+
let res = to_titlecase("FIST", "tr", "default");
|
|
256
|
+
assert_eq!(res, "Fıst");
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
#[test]
|
|
260
|
+
fn cast_from_legacy_option() {
|
|
261
|
+
let res = to_titlecase("FIST", "en", Some(StyleGuide::DaringFireball));
|
|
262
|
+
assert_eq!(res, "Fist");
|
|
263
|
+
let res = to_titlecase("FIST", "en", None);
|
|
264
|
+
assert_eq!(res, "Fist");
|
|
265
|
+
}
|
|
266
|
+
|
|
247
267
|
macro_rules! titlecase {
|
|
248
268
|
($name:ident, $locale:expr, $style:expr, $input:expr, $expected:expr) => {
|
|
249
269
|
#[test]
|
|
@@ -254,116 +274,122 @@ mod tests {
|
|
|
254
274
|
};
|
|
255
275
|
}
|
|
256
276
|
|
|
257
|
-
titlecase!(
|
|
277
|
+
titlecase!(
|
|
278
|
+
abc_none,
|
|
279
|
+
Locale::EN,
|
|
280
|
+
StyleGuide::LanguageDefault,
|
|
281
|
+
"a b c",
|
|
282
|
+
"A B C"
|
|
283
|
+
);
|
|
258
284
|
|
|
259
285
|
titlecase!(
|
|
260
286
|
abc_cmos,
|
|
261
|
-
|
|
262
|
-
|
|
287
|
+
Locale::EN,
|
|
288
|
+
StyleGuide::ChicagoManualOfStyle,
|
|
263
289
|
"a b c",
|
|
264
290
|
"A B C"
|
|
265
291
|
);
|
|
266
292
|
|
|
267
293
|
titlecase!(
|
|
268
294
|
abc_gruber,
|
|
269
|
-
|
|
270
|
-
|
|
295
|
+
Locale::EN,
|
|
296
|
+
StyleGuide::DaringFireball,
|
|
271
297
|
"a b c",
|
|
272
298
|
"A B C"
|
|
273
299
|
);
|
|
274
300
|
|
|
275
301
|
titlecase!(
|
|
276
302
|
simple_cmos,
|
|
277
|
-
|
|
278
|
-
|
|
303
|
+
Locale::EN,
|
|
304
|
+
StyleGuide::ChicagoManualOfStyle,
|
|
279
305
|
"Once UPON A time",
|
|
280
306
|
"Once upon a Time"
|
|
281
307
|
);
|
|
282
308
|
|
|
283
309
|
titlecase!(
|
|
284
310
|
simple_gruber,
|
|
285
|
-
|
|
286
|
-
|
|
311
|
+
Locale::EN,
|
|
312
|
+
StyleGuide::DaringFireball,
|
|
287
313
|
"Once UPON A time",
|
|
288
314
|
"Once UPON a Time"
|
|
289
315
|
);
|
|
290
316
|
|
|
291
317
|
titlecase!(
|
|
292
318
|
colon_cmos,
|
|
293
|
-
|
|
294
|
-
|
|
319
|
+
Locale::EN,
|
|
320
|
+
StyleGuide::ChicagoManualOfStyle,
|
|
295
321
|
"foo: a baz",
|
|
296
322
|
"Foo: a Baz"
|
|
297
323
|
);
|
|
298
324
|
|
|
299
325
|
titlecase!(
|
|
300
326
|
colon_gruber,
|
|
301
|
-
|
|
302
|
-
|
|
327
|
+
Locale::EN,
|
|
328
|
+
StyleGuide::DaringFireball,
|
|
303
329
|
"foo: a baz",
|
|
304
330
|
"Foo: A Baz"
|
|
305
331
|
);
|
|
306
332
|
|
|
307
333
|
// titlecase!(
|
|
308
334
|
// qna_cmos,
|
|
309
|
-
//
|
|
310
|
-
//
|
|
335
|
+
// Locale::EN,
|
|
336
|
+
// StyleGuide::ChicagoManualOfStyle,
|
|
311
337
|
// "Q&A with Steve Jobs: 'That's what happens in technology'",
|
|
312
338
|
// "Q&a with Steve Jobs: 'that's What Happens in Technology'"
|
|
313
339
|
// );
|
|
314
340
|
|
|
315
341
|
titlecase!(
|
|
316
342
|
qna_gruber,
|
|
317
|
-
|
|
318
|
-
|
|
343
|
+
Locale::EN,
|
|
344
|
+
StyleGuide::DaringFireball,
|
|
319
345
|
"Q&A with Steve Jobs: 'That's what happens in technology'",
|
|
320
346
|
"Q&A With Steve Jobs: 'That's What Happens in Technology'"
|
|
321
347
|
);
|
|
322
348
|
|
|
323
349
|
titlecase!(
|
|
324
350
|
ws_gruber,
|
|
325
|
-
|
|
326
|
-
|
|
351
|
+
Locale::EN,
|
|
352
|
+
StyleGuide::DaringFireball,
|
|
327
353
|
" free trolling\n space ",
|
|
328
354
|
" Free Trolling\n Space "
|
|
329
355
|
);
|
|
330
356
|
|
|
331
357
|
titlecase!(
|
|
332
358
|
turkish_question,
|
|
333
|
-
|
|
334
|
-
|
|
359
|
+
Locale::TR,
|
|
360
|
+
StyleGuide::LanguageDefault,
|
|
335
361
|
"aç mısın",
|
|
336
362
|
"Aç mısın"
|
|
337
363
|
);
|
|
338
364
|
|
|
339
365
|
titlecase!(
|
|
340
366
|
turkish_question_false,
|
|
341
|
-
|
|
342
|
-
|
|
367
|
+
Locale::TR,
|
|
368
|
+
StyleGuide::LanguageDefault,
|
|
343
369
|
"dualarımızda minnettarlık",
|
|
344
370
|
"Dualarımızda Minnettarlık"
|
|
345
371
|
);
|
|
346
372
|
|
|
347
373
|
titlecase!(
|
|
348
374
|
turkish_chars,
|
|
349
|
-
|
|
350
|
-
|
|
375
|
+
Locale::TR,
|
|
376
|
+
StyleGuide::LanguageDefault,
|
|
351
377
|
"İLKİ ILIK ÖĞLEN",
|
|
352
378
|
"İlki Ilık Öğlen"
|
|
353
379
|
);
|
|
354
380
|
|
|
355
381
|
titlecase!(
|
|
356
382
|
turkish_blockwords,
|
|
357
|
-
|
|
358
|
-
|
|
383
|
+
Locale::TR,
|
|
384
|
+
StyleGuide::LanguageDefault,
|
|
359
385
|
"Sen VE ben ile o",
|
|
360
386
|
"Sen ve Ben ile O"
|
|
361
387
|
);
|
|
362
388
|
|
|
363
389
|
titlecase!(
|
|
364
390
|
turkish_ws,
|
|
365
|
-
|
|
366
|
-
|
|
391
|
+
Locale::TR,
|
|
392
|
+
StyleGuide::LanguageDefault,
|
|
367
393
|
" serbest serseri\n boşluk ",
|
|
368
394
|
" Serbest Serseri\n Boşluk "
|
|
369
395
|
);
|
|
@@ -378,16 +404,11 @@ mod tests {
|
|
|
378
404
|
};
|
|
379
405
|
}
|
|
380
406
|
|
|
381
|
-
lowercase!(
|
|
382
|
-
lower_en,
|
|
383
|
-
InputLocale::EN,
|
|
384
|
-
"foo BAR BaZ BIKE",
|
|
385
|
-
"foo bar baz bike"
|
|
386
|
-
);
|
|
407
|
+
lowercase!(lower_en, Locale::EN, "foo BAR BaZ BIKE", "foo bar baz bike");
|
|
387
408
|
|
|
388
409
|
lowercase!(
|
|
389
410
|
lower_tr,
|
|
390
|
-
|
|
411
|
+
Locale::TR,
|
|
391
412
|
"foo BAR BaZ ILIK İLE",
|
|
392
413
|
"foo bar baz ılık ile"
|
|
393
414
|
);
|
|
@@ -402,16 +423,11 @@ mod tests {
|
|
|
402
423
|
};
|
|
403
424
|
}
|
|
404
425
|
|
|
405
|
-
uppercase!(
|
|
406
|
-
upper_en,
|
|
407
|
-
InputLocale::EN,
|
|
408
|
-
"foo BAR BaZ bike",
|
|
409
|
-
"FOO BAR BAZ BIKE"
|
|
410
|
-
);
|
|
426
|
+
uppercase!(upper_en, Locale::EN, "foo BAR BaZ bike", "FOO BAR BAZ BIKE");
|
|
411
427
|
|
|
412
428
|
uppercase!(
|
|
413
429
|
upper_tr,
|
|
414
|
-
|
|
430
|
+
Locale::TR,
|
|
415
431
|
"foo BAR BaZ ILIK İLE",
|
|
416
432
|
"FOO BAR BAZ ILIK İLE"
|
|
417
433
|
);
|
|
@@ -428,15 +444,10 @@ mod tests {
|
|
|
428
444
|
|
|
429
445
|
sentencecase!(
|
|
430
446
|
sentence_en,
|
|
431
|
-
|
|
447
|
+
Locale::EN,
|
|
432
448
|
"insert BIKE here",
|
|
433
449
|
"Insert bike here"
|
|
434
450
|
);
|
|
435
451
|
|
|
436
|
-
sentencecase!(
|
|
437
|
-
sentence_tr,
|
|
438
|
-
InputLocale::TR,
|
|
439
|
-
"ilk DAVRANSIN",
|
|
440
|
-
"İlk davransın"
|
|
441
|
-
);
|
|
452
|
+
sentencecase!(sentence_tr, Locale::TR, "ilk DAVRANSIN", "İlk davransın");
|
|
442
453
|
}
|