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

In combine_words, when words vector is length 2 and and is blank, use sep #2045

Merged
merged 4 commits into from
Sep 21, 2021

Conversation

cderv
Copy link
Collaborator

@cderv cderv commented Sep 21, 2021

This fixes #2044

@yihui I don't know if this is the fix you were expected.

The behavior described in #2044 is currently the one documented:

When words is of length 2, the first word and second word are combined using the and string.

knitr::combine_words(c("a", "b"), before = "`", and = "")
#> `a``b`
knitr::combine_words(c("a", "b"), before = "`", and = " or ")
#> `a` or `b`

What I am proposing here is that we support a special case: When length is two AND knitr::is_blank(and), then we use sep

knitr::combine_words(c("a", "b"), before = "`", and = "")
#> `a`, `b`
knitr::combine_words(c("a", "b"), before = "`", and = " or ")
#> `a` or `b`

Is that ok ?

@cderv cderv requested a review from yihui September 21, 2021 09:57
Copy link
Owner

@yihui yihui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good to me. Thank you!

@yihui yihui merged commit ef4a475 into master Sep 21, 2021
@yihui yihui deleted the fix/combine-words branch September 21, 2021 13:04
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

behavior of combine_words when vector length is 2 and the and option is empty
2 participants