Repository navigation
file_scope is now correctly merged when creating output_format - #2488
Conversation
|
Note that I noticed this when adding tests on #2462, which should be able to extend file_scope from within chunks. |
yihui
left a comment
There was a problem hiding this comment.
Looks good to me. Thanks!
There was a problem hiding this comment.
Sorry for the delay on this @atusy.
it looks good to me. I think it won't break current behavior. Only place that we use it in in bookdown. It is even deactivated by default, and could be completely broken in fact ... :(
I am just curious: do we have a use case where we think merging file_scope requires applying overlay on base results ?
To me this would mean that we want to define a format that would for example extend gitbook() but would split again each of the splitted file, instead of providing an overwrite of the split function. Is that right ?
Just trying to understand correctly. I guess someone can do a function that ignores current_scope to completely ignore the base splitted content.
I was thinking maybe the latter would be the desired behavior when extending the base format. So I was curious if this change was driven by a use case. Thanks.
Other than this question I have, the implementation looks very good ! thanks a lot !
[skip ci]
cderv
left a comment
There was a problem hiding this comment.
In fact it is all good. Both usage can be done. Let's go with this default. Thanks a lot !
|
Actually I'm not sure if there would be any practical usecases... One exception is test. |
|
Good use case ! I had not thought of that 😆 |
* rstudio/main: start the next version CRAN release v2.24 shinyrmd: Safer dependency extraction from pre-rendered HTML (rstudio#2500) quote the version number per CRAN's request Add output_format_dependency() (rstudio#2462) file_scope is now correctly merged when creating output_format (rstudio#2488) Correctly run some tests only on CI start the next version CRAN release v2.23 remove broken links suggest cleanrmd for e499bf7 add news comparing version numbers with numbers is no longer allowed: https://bugs.r-project.org/show_bug.cgi?id=18548 `find_external_resources` works with custom format using `theme` (rstudio#2494) start the next version CRAN release v2.22 S3 generic/method consistency Change the code-folding button text from "Code" to "Show" (rstudio#2489) fix: bump jquery-ui to v1.13.2 to fix multiple CVEs (rstudio#2477) detecting external resources needs to consider css argument (rstudio#2486)
Merge remote-tracking branch 'rstudio/main' into jg-devel # By Yihui Xie (13) and others # Via Yihui Xie * rstudio/main: start the next version CRAN release v2.24 shinyrmd: Safer dependency extraction from pre-rendered HTML (rstudio#2500) quote the version number per CRAN's request Add output_format_dependency() (rstudio#2462) file_scope is now correctly merged when creating output_format (rstudio#2488) Correctly run some tests only on CI start the next version CRAN release v2.23 remove broken links suggest cleanrmd for e499bf7 add news comparing version numbers with numbers is no longer allowed: https://bugs.r-project.org/show_bug.cgi?id=18548 `find_external_resources` works with custom format using `theme` (rstudio#2494) start the next version CRAN release v2.22 S3 generic/method consistency Change the code-folding button text from "Code" to "Show" (rstudio#2489) fix: bump jquery-ui to v1.13.2 to fix multiple CVEs (rstudio#2477) detecting external resources needs to consider css argument (rstudio#2486) # Conflicts: # DESCRIPTION
* jg-devel: (21 commits) Updated NEWS. Patched `merge_output_format_dependency` to ensure that named elements remain in the correct order. start the next version CRAN release v2.24 shinyrmd: Safer dependency extraction from pre-rendered HTML (rstudio#2500) quote the version number per CRAN's request Add output_format_dependency() (rstudio#2462) file_scope is now correctly merged when creating output_format (rstudio#2488) Correctly run some tests only on CI start the next version CRAN release v2.23 remove broken links suggest cleanrmd for e499bf7 add news comparing version numbers with numbers is no longer allowed: https://bugs.r-project.org/show_bug.cgi?id=18548 `find_external_resources` works with custom format using `theme` (rstudio#2494) start the next version CRAN release v2.22 S3 generic/method consistency Change the code-folding button text from "Code" to "Show" (rstudio#2489) fix: bump jquery-ui to v1.13.2 to fix multiple CVEs (rstudio#2477) ...
Currently, new output format ignores the file scope of the base format.
It is totally lost.
In this PR I fix the above behavior and add
merge_file_scope().To achieve merging,
file_scopefunction needs two arguments, and the latter is newinput_fileswhich already existscurrent_file_scopewhich is determined by the basefile_scopefunctionIn this way, overlay can take into account of file scope determined by the base.
This is an API change, so I added some warnings and fallback mechanisms.