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

Add comma as a splitting token in toTitleCase() #174

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Bisaloo
Copy link

@Bisaloo Bisaloo commented Jul 12, 2024

tools::toTitleCase() documentation indicates that words surrounded by single quotes are protected from change:

However, unknown technical terms will be capitalized unless they are single words enclosed in single quotes: names of packages and libraries should be quoted in titles.

But this doesn't work when the quoted word is immediately followed by a comma:

tools::toTitleCase("Import and Export 'SPSS', 'Stata' and 'SAS' Files")
#> [1] "Import and Export 'Spss', 'Stata' and 'SAS' Files"

tools::toTitleCase("Import and Export 'SPSS' 'Stata' and 'SAS' Files")
#> [1] "Import and Export 'SPSS' 'Stata' and 'SAS' Files"

Created on 2024-07-12 with reprex v2.1.1

The proposed patch fixes this by adding the comma to the splitting tokens.

I have verified on my local library on 1400 R packages that this does not cause any unexpected changes when applied to their Title field in DESCRIPTION.

This is the result of a collaboration with @sarahzeller @shannonpileggi @reikookamoto at the R Dev Day PLUS 2024.

Once checks have been confirmed passing, I will submit this report & patch proposal as a new bugzilla entry.

@Bisaloo Bisaloo force-pushed the totitlecase-comma-unprotecting branch from f802b23 to b7467c0 Compare July 12, 2024 14:58
@Bisaloo
Copy link
Author

Bisaloo commented Jul 13, 2024

Submitted bug report & proposed patch in https://bugs.r-project.org/show_bug.cgi?id=18764.

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 this pull request may close these issues.

1 participant