Skip to content

Don't fallback to parse usual R comments in Quarto #2225

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

Merged
merged 10 commits into from
Apr 3, 2025

Conversation

cderv
Copy link
Collaborator

@cderv cderv commented Feb 10, 2023

This is related to discussion in quarto-dev/quarto-cli#4306

Making this draft PR to test a scenario and discuss. This is WIP

Regarding second commit, if we don't error but just don't fallback we would get this behavior with an obscure error due to in chunk content not being parsed as option

---
title: "Example"
format: html
engine: knitr
---

```{r}
# install.packages(c("DBI", "RSQLite"))
db = DBI::dbConnect(RSQLite::SQLite(), ":memory:")
```

```{sql}
#| label: test multiqueries -5
#|  connection: db

select 1
```
processing file: test2.qmd
  |..........................................          |  80% (unnamed-chunk-2)Quitting from lines 14-18 (test2.qmd)
Error:
! The 'connection' option (DBI connection) is required for sql chunks.
Backtrace:
  1. global .main()
  2. execute(...)
  3. rmarkdown::render(...)
  4. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
  5. knitr:::process_file(text, output)
  8. knitr:::process_group.block(group)
  9. knitr:::call_block(x)
 10. knitr:::block_exec(params)
 13. knitr (local) engine(options)
 14. knitr:::stop2("The 'connection' option (DBI connection) is required for sql chunks.")
                                                                                                            Exécution arrêtée

@yihui yihui self-assigned this Mar 4, 2025
yihui added a commit to yihui/xfun that referenced this pull request Mar 4, 2025
…sing `#|` when `#` is not the comment char of the engine (yihui/knitr#2225), and also add argument `...` to make it possible to not use the yaml package when parsing YAML options (i.e., divide_chunk(use_yaml = FALSE))
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.

This can be merged after xfun 0.52 is on CRAN.

@cderv cderv marked this pull request as ready for review March 5, 2025 09:49
@yihui yihui merged commit 36614d4 into master Apr 3, 2025
10 checks passed
@yihui yihui deleted the in-chunk-comment-fallback branch April 3, 2025 01:17
clrpackages pushed a commit to clearlinux-pkgs/R-xfun that referenced this pull request Apr 10, 2025
Yihui Xie (12):
      start the next version
      fix a bug in taml_load() that converts chars in arrays to lowercase, and also allow single quotes in char values in arrays
      add an argument `strict` divide_chunk() to disallow falling back to using `#|` when `#` is not the comment char of the engine (yihui/knitr#2225), and also add argument `...` to make it possible to not use the yaml package when parsing YAML options (i.e., divide_chunk(use_yaml = FALSE))
      a new function url_destination() to get destination of redirected URLs
      deprecate `xfun::attr()` in favor of `xfun::attr2()` to avoid masking `base::attr()` (#96)
      a simple implementation of LCG (#101)
      close #100: demote cache_rds() and promote cache_exec()
      close #99: add an argument `date` to `pkg_bib()` to optionally include the date of retrieval in the bib entries
      bye, solaris
      remove unused add_border() (it was written primarily for me to add border to raster images to be included in LaTeX, but I no longer use LaTeX now, and adding borders to images via CSS is trivially simple)
      leave out renv and rmarkdown in Suggests
      CRAN release v0.52
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.

2 participants