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

%title{ } Capitalize after apostrophe #3033

Closed
ghost opened this issue Sep 15, 2018 · 4 comments · Fixed by #3059
Closed

%title{ } Capitalize after apostrophe #3033

ghost opened this issue Sep 15, 2018 · 4 comments · Fixed by #3059
Labels
bitesize feature features we would like to implement

Comments

@ghost
Copy link

ghost commented Sep 15, 2018

Problem

When you add %title{} to something for example %title{$title}, the capitalization is also done after an apostrophe, leading to some weird capitalization like "Can'T" "Don'T" "I'M" ...

Example :

"50 Cent - If I Can't" become "50 Cent - If I Can'T"

Setup

  • OS: Arch Linux
  • Python version: Latest
  • beets version: Latest
  • Turning off plugins made problem go away (yes/no): N/A
@sampsyo sampsyo added feature features we would like to implement bitesize labels Sep 15, 2018
@sampsyo
Copy link
Member

sampsyo commented Sep 15, 2018

Good point! This could be smarter than Python’s built-in str.title, especially when it comes to Unicode. This would be a good first issue for anyone getting into hacking on beets.

@jackwilsdon
Copy link
Member

Looks like replacing it with capwords should do it: https://stackoverflow.com/a/8199981/2664985

@sampsyo
Copy link
Member

sampsyo commented Sep 15, 2018

Awesome; good find, @jackwilsdon. Do you know whether it works with Unicode punctuation like ‘’?

@jackwilsdon
Copy link
Member

Looks like it works as expected 👍

>>> import string
>>> string.capwords("Testing the q‘uote’s", " ")
'Testing The Q‘uote’s'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bitesize feature features we would like to implement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants