-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Word count: Adjust to count numbers as words #27288
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on texts from similar issue (#17988) and PR looks good to me.
I don't think tests are failing because of your code. You can try to rebase to force tests to rerun.
Thanks! But would you mind show me how to perform a rebase (or other ways to rerun the test)? I am really learning.... |
You'll still need a review from someone with write permissions (which i don't have) for PR to get merged. Good luck! |
characters_excluding_spaces: 15, | ||
characters_including_spaces: 19, | ||
}, | ||
{ | ||
message: 'Numbers as word', | ||
string: 'Should be 4 words', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see also a comment from @Soean in #26339 (comment):
Good point, I tested Microsoft Word, Google Docs and Libre office, all apps count numbers as a word. So I think we should change it in WordPress
@@ -43,10 +43,17 @@ describe( 'WordCounter', () => { | |||
{ | |||
message: 'Punctuation.', | |||
string: 'It’s two three \u2026 4?', | |||
words: 3, | |||
words: 4, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -50,7 +50,7 @@ export const defaultSettings = { | |||
'[', | |||
|
|||
// Basic Latin (extract) | |||
'\u0021-\u0040\u005B-\u0060\u007B-\u007E', | |||
'\u0021-\u002F\u003A-\u0040\u005B-\u0060\u007B-\u007E', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirm that it allows now digits from 0 to 9 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR needs a rebase or, a commit with a note in the CHANGELOG about the change applied.
Congratulations on your first merged pull request, @phena109! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts: https://profiles.wordpress.org/me/profile/edit/ And if you don't have a WordPress.org account, you can create one on this page: https://login.wordpress.org/register Kudos! |
@phena109, thank you for working on this PR and your patience. It took a while to land it 😅 I couldn't add changes to the branch so I will open a follow-up with a note about the changes applied to the |
Description
Adjusted the character range to be removed so count logic can count numbers.
Fixes #26339
How has this been tested?
Used the unit test suite come with the repo. I have adjusted 1 existing case and added a new one
Types of changes
Adjusted the character range to be removed so count logic can count numbers. It doesn't break anything. All test related to the
wordcount
package passedChecklist: