Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't lowercase small words #6

Closed
q3cpma opened this issue Aug 29, 2022 · 4 comments · Fixed by #7
Closed

Doesn't lowercase small words #6

q3cpma opened this issue Aug 29, 2022 · 4 comments · Fixed by #7

Comments

@q3cpma
Copy link

q3cpma commented Aug 29, 2022

For example

$ echo 'Way Of The Dragon' | titlecase
Way Of The Dragon
@wezm
Copy link
Owner

wezm commented Aug 29, 2022

Well that's embarrassing, thanks for the bug report. Can't believe I don't have a test case for that, despite the behaviour being mentioned in the README. The code looks like it's trying to do it:

titlecase/src/lib.rs

Lines 115 to 116 in 9366767

} else if SMALL_RE.is_match(word) {
word.to_lowercase()

But I suspect the \A and \z in SMALL_RE are not right.

static ref SMALL_RE: Regex = Regex::new(&format!(r"\A(?:{})\z", SMALL_WORDS.join("|")))

@q3cpma
Copy link
Author

q3cpma commented Aug 30, 2022 via email

@wezm
Copy link
Owner

wezm commented Aug 30, 2022

Published v2.1.0 with a fix for this.

@q3cpma
Copy link
Author

q3cpma commented Aug 30, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants