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

Loop correctly on splitted file by file_scope function #2150

Merged
merged 5 commits into from
May 28, 2021

Conversation

cderv
Copy link
Collaborator

@cderv cderv commented May 28, 2021

This will fix #2149 (at least the error mentioned but I don't see the relation to Lua filters 🤷 )

It resolve a name conflict after change in 92b437a (#2098) that caused an issue with file_scope for loop.

I took the time to add some test so that we can detect this next time (if any).
To do a proper unit test (and not a big rendering test), I refactored by moving out the file scope logic into a function. Also, I used snapshot tests on the dummy example as it is simple and works well in this case.

Hope this is fine.

@cderv cderv requested a review from yihui May 28, 2021 10:04
Copy link
Member

@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.

To do a proper unit test (and not a big rendering test), I refactored by moving out the file scope logic into a function.

That's great! To be honest, render() is a too big function and I'm all for splitting it into smaller ones, which can be good for both testing and avoiding inadvertent name conflicts.

R/render.R Outdated Show resolved Hide resolved
R/render.R Outdated Show resolved Hide resolved
@yihui yihui added this to the v2.9 milestone May 28, 2021
@yihui yihui added the next to consider for next release label May 28, 2021
cderv and others added 2 commits May 28, 2021 16:11
@cderv cderv merged commit 8be459a into master May 28, 2021
@cderv cderv deleted the fix/2149-file-scope-issue branch May 28, 2021 14:28
jonathan-g added a commit to jonathan-g/rmarkdown that referenced this pull request Jun 18, 2021
* rstudio_origin/master: (90 commits)
  start the next version
  CRAN release v2.9
  fix rstudio#2163: do not normalize web paths in the css argument of html output formats (rstudio#2164)
  Add a css file for future tests
  Restore previous shiny theme when run() exits (rstudio#2160)
  Correct name in workflow file
  Add a workflow to test Pandoc nighly (rstudio#2153)
  bslib 0.2.5.1 is now on CRAN
  use `stop2()` from knitr internal instead of `stop(..., call. = FALSE)` (rstudio#2152)
  74e2f2f changed the error message, and a test relies on the content of this message (it probably shouldn't be so specific)
  tweak wording
  Support 'href' dependencies (rstudio#2151)
  Loop correctly on splitted file by file_scope function (rstudio#2150)
  update snapshot file following change in test name in a8aad75
  amend 84ff469: clarify the meaning of fig_crop = 'auto' in the doc
  Add the position of the last character (rstudio#2146)
  don't put the checklist in the comment since it is required
  Fix for lost encoding in shiny_prerendered_html. (rstudio#2140)
  Insure fontawesome V4 compatibility in navbar (rstudio#1994)
  fix rstudio#2043: replace parse(text) with xfun::parse_only() to avoid hanging the R session when the input is empty
  ...
jonathan-g added a commit to jonathan-g/rmarkdown that referenced this pull request Jun 18, 2021
Merge remote-tracking branch 'rstudio_origin/master' into jg-devel

* rstudio_origin/master: (64 commits)
  start the next version
  CRAN release v2.9
  fix rstudio#2163: do not normalize web paths in the css argument of html output formats (rstudio#2164)
  Add a css file for future tests
  Restore previous shiny theme when run() exits (rstudio#2160)
  Correct name in workflow file
  Add a workflow to test Pandoc nighly (rstudio#2153)
  bslib 0.2.5.1 is now on CRAN
  use `stop2()` from knitr internal instead of `stop(..., call. = FALSE)` (rstudio#2152)
  74e2f2f changed the error message, and a test relies on the content of this message (it probably shouldn't be so specific)
  tweak wording
  Support 'href' dependencies (rstudio#2151)
  Loop correctly on splitted file by file_scope function (rstudio#2150)
  update snapshot file following change in test name in a8aad75
  amend 84ff469: clarify the meaning of fig_crop = 'auto' in the doc
  Add the position of the last character (rstudio#2146)
  don't put the checklist in the comment since it is required
  Fix for lost encoding in shiny_prerendered_html. (rstudio#2140)
  Insure fontawesome V4 compatibility in navbar (rstudio#1994)
  fix rstudio#2043: replace parse(text) with xfun::parse_only() to avoid hanging the R session when the input is empty
  ...

# Conflicts:
#	DESCRIPTION
#	R/html_dependencies.R
jonathan-g added a commit to jonathan-g/rmarkdown that referenced this pull request Jun 18, 2021
Merge remote-tracking branch 'rstudio_origin/master' into minimal-tree-fix

* rstudio_origin/master: (223 commits)
  start the next version
  CRAN release v2.9
  fix rstudio#2163: do not normalize web paths in the css argument of html output formats (rstudio#2164)
  Add a css file for future tests
  Restore previous shiny theme when run() exits (rstudio#2160)
  Correct name in workflow file
  Add a workflow to test Pandoc nighly (rstudio#2153)
  bslib 0.2.5.1 is now on CRAN
  use `stop2()` from knitr internal instead of `stop(..., call. = FALSE)` (rstudio#2152)
  74e2f2f changed the error message, and a test relies on the content of this message (it probably shouldn't be so specific)
  tweak wording
  Support 'href' dependencies (rstudio#2151)
  Loop correctly on splitted file by file_scope function (rstudio#2150)
  update snapshot file following change in test name in a8aad75
  amend 84ff469: clarify the meaning of fig_crop = 'auto' in the doc
  Add the position of the last character (rstudio#2146)
  don't put the checklist in the comment since it is required
  Fix for lost encoding in shiny_prerendered_html. (rstudio#2140)
  Insure fontawesome V4 compatibility in navbar (rstudio#1994)
  fix rstudio#2043: replace parse(text) with xfun::parse_only() to avoid hanging the R session when the input is empty
  ...

# Conflicts:
#	DESCRIPTION
#	NEWS.md
#	R/html_dependencies.R
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
next to consider for next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lua filters broken since v2.8
2 participants