-
-
Notifications
You must be signed in to change notification settings - Fork 878
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
Convert dashes in chunk option names to dots #2282
Conversation
…(converting dashes to dots)
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.
Oh so you do that in general fix_options
🤔
I was thinking to keep that YAML parsing specific, in the partition function.
Like
- Parsing YAML options - those could be dashed version probably
- Substitute - by .
- Use
knitr::merge_list()
to merge so options parsed from YAML with any other existing, including the knitr default one.
Doing in fix_options()
is more general. Could be ok if you think so.
Only thoughs are:
- Indeed, if someone is already using knitr option with
-
, it will break (probably rare as you think) - I did the equivalent of that in my branch on Quarto side
dashes = grep('-', names(options), value = TRUE)
options[gsub('-', '.', dashes)] = options[dashes]
options[dashes] = NULL
and I though this could may have side effect considering order if some .
options are after their -
version in options
- Something related to matter of order when duplicated and which should be taken first.
But I guess the situation may not happen.
Other than those thoughts, it looks good to me.
The problem with that is users might have set global chunk options (which contain dashes) in the YAML metadata of the Quarto document. By doing the conversion in
You fixed this problem in quarto-dev/quarto-cli@0af9c8a. I'm using the same fix. Previous in Quarto the list of chunk options could contain duplicated options like I'll let you merge this PR since I don't have the privilege to close issues in the quarto-cli repo. If you merge it, it may automatically close the two issues. Thanks! |
Maybe closing #2214? |
@yihui this PR is breaking Quarto right now. I think this all lies in your original comment
Quarto is only normalizing known knitr options currently. It means it assumes that unknown knitr option will still have dash ( I am trying to see if this is only something of hard coded dashed version in R code to be used with dot version, but I believe this is more generic. I think Quarto was assuming that unknown knitr options would still have their dash in For example here, We should discuss this IMO.
Overall, there is a scope question IMO:
It seems that either on knitr or quarto side there will be a list of options to maintain. (we could ease that by having an object for this like |
And also We may need to revert this PR and synchronize it with next Quarto version to not create breakage - we have the conflict Quarto version + knitr version to deal with 🤔 |
Okay, I'm glad that we started testing Quarto against the dev version of knitr. First, I think we should definitely normalize the dashes before |
…own to knitr, and leave other names untouched (e.g., those specific to Quarto); also do this conversion before `opts_hooks` runs
I just pushed another commit, and I think the problems should be mitigated. Let's see if there is anything else we missed. |
It seems to be all good on Quarto side now - at least for everything that is testing in CI. Two things to do with this new commit:
I guess you are already onto this. |
Yes, I think I'm done now. Waiting for CI jobs to finish. |
Fix quarto-dev/quarto-cli#5852.
@cderv Instead of enumerating specific options, I'm just substituting all dashes to dots. The advantage is that we don't need to maintain a list of hard-coded option names (e.g., if we add new chunk options to knitr in future, we won't need to update this list). The downside is that users might really want to use dashes in option names, but I think this should be rare.
Also fix quarto-dev/quarto-cli#6576.