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

Comments

Projects
None yet
2 participants
@ghost
Copy link

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

commented Sep 15, 2018

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

@sampsyo

This comment has been minimized.

Copy link
Member

commented Sep 15, 2018

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

@jackwilsdon

This comment has been minimized.

Copy link
Member

commented Sep 15, 2018

Looks like it works as expected 👍

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

@GuilhermeHideki GuilhermeHideki referenced this issue Oct 22, 2018

Merged

WIP: Enhance %title #3059

3 of 3 tasks complete

GuilhermeHideki added a commit that referenced this issue Nov 29, 2018

GuilhermeHideki added a commit that referenced this issue Nov 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.