Skip to content

Conversation

@Bisaloo
Copy link
Member

@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
Member Author

Bisaloo commented Jul 13, 2024

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

@Bisaloo
Copy link
Member Author

Bisaloo commented Aug 23, 2025

Committed in 36d20e6.

@Bisaloo Bisaloo closed this Aug 23, 2025
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