quarto-dev / quarto-dev/quarto-cli

Quarto render with --execute-params only updates executable code but not shortcode

Aperta
#11,167 19 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

enhancement needs-design parameters
Lingua principale
JavaScript
Stelle
6k
Fork
458
Merge medio
1g 9h
PR unite (30g)
41

Descrizione

Bug description

Given a main qmd document test.qmd, when specifying the params externally in a params.yml file and trying the quarto render test.qmd --execute-params params.yaml the parameters are only updated in the portion of executable code (e.g. those included within an R chunk), but not for the shortcodes. Is this an intentional behaviour?

Steps to reproduce

test.qmd


---
title: "Conditional content with params"
format: html 
editor: visual
params:
  print: FALSE
---

::: {.content-hidden unless-meta="params.print"}
If PRINT parameter is TRUE, we'll show this.

shortcode shows PRINT = {{< meta params.print >}}

```{r, echo=FALSE}
cat("executed code shows PRINT = ", params$print)
if(params$print){
  cat("Hello World")
} else {
  cat("Not printing anything, because params$print is FALSE")
}
```
:::

::: {.content-hidden when-meta="params.print"}
If PRINT parameter is FALSE, we'll show this instead.

shortcode shows PRINT = {{< meta params.print >}}

```{r, echo=FALSE}
cat("executed code shows PRINT = ", params$print)
if(params$print){
  cat("Hello World")
} else {
  cat("Not printing anything, because params$print is FALSE")
}
```
:::

params.yml

print: FALSE
Expected behavior
Conditional content with params

If PRINT parameter is FALSE, we’ll show this instead.

shortcode shows PRINT = false

executed code shows PRINT = FALSE

Not printing anything, because params$print is FALSE

Actual behavior
Conditional content with params

If PRINT parameter is FALSE, we'll show this.

shortcode shows PRINT = true

executed code shows PRINT = FALSE

Not printing anything, because params$print is FALSE

Your environment
  • IDE: Rstudio 2024.04.2+764
  • OS: Windows 10 22H2
Quarto check output

Quarto 1.4.555
[>] Checking versions of quarto binary dependencies...
Pandoc version 3.1.11: OK
Dart Sass version 1.69.5: OK
Deno version 1.37.2: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
Version: 1.4.555
CodePage: 1252

[>] Checking tools....................OK
TinyTeX: (not installed)
Chromium: (not installed)

[>] Checking LaTeX....................OK
Tex: (not detected)

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....OK
Version: 3.11.2
Jupyter: 5.2.0
Kernels: python3

[>] Checking Jupyter engine render....OK

[>] Checking R installation...........OK
Version: 4.4.1
knitr: 1.48
rmarkdown: 2.28

[>] Checking Knitr engine render......OK

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Reproduce the behavior with quarto render test.qmd --execute-params params.yaml, using the supplied test.qmd and params.yml. Trace how external execution parameters reach executable R code versus the {{< meta params.print >}} shortcode. Done means both the shortcode and executable code reflect the externally supplied value, with regression coverage for the example.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, r
Ambito
tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.