quarto-dev / quarto-dev/quarto-cli

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

Offen
#11,167 19 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

enhancement needs-design parameters
Vorherrschende Sprache
JavaScript
Sterne
6k
Forks
458
Ø Merge
1 T. 9 Std.
Gemergte PRs (30 T.)
41

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, r
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.