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

Fix CRAN Warning when non-breaking space in default function argument value #1343

Closed
wants to merge 4 commits into from

Conversation

zeehio
Copy link

@zeehio zeehio commented May 2, 2022

I don't have all the context of why there are non-breaking spaces introduced and afterwards replaced. Probably it was a Windows encoding issue already addressed on R-4.2, with its UTF-8 improvements.

The change in this pull request is as follows:

Before:

  • The usage Rd section uses a structure like: "<argument_name><space>=<space><default_value>" for each argument
  • When default_value contains "\u{A0}" (a non-breaking space character), the generated usage replaces that character with a regular space, leading to a CRAN warning due to the mismatch. (This is a bug, in my opinon)

After:

  • The usage Rd section uses a structure like: "<argument_name><space>=<space><default_value>", as before.
  • When default_value contains "\u{A0}" (a non-breaking space character), the generated usage preserves that character and does not replace it anymore. May this cause rendering issues on older Windows using locales incompatible with nbsp? Maybe, but I would argue this hasn't happened until now (because if it had happened there would have been a CRAN Warning due to the bug mentioned above) and it probably won't happen after R4.2, since windows builds use UTF-8 there, as far as I know. So I would expect low chances of regressions.

In the future, when R4.2 is required and assuming non-breaking spaces are well supported in R-4.2 Rd files, roxygen2 could use non-breaking spaces to wrap the = sign that separates the argument name from its default value. This is out of the scope of this pull request.

hadley added a commit that referenced this pull request Jul 7, 2022
hadley added a commit that referenced this pull request Jul 7, 2022
@hadley hadley closed this in #1383 Jul 7, 2022
hadley added a commit that referenced this pull request Jul 7, 2022
@zeehio zeehio deleted the fix-nbsp-usage branch July 8, 2022 20:08
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.

CRAN Warning when Non-breaking space in default function argument value
1 participant