quarto-dev / quarto-dev/quarto-cli

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

Ouverte
#11,167 19 commentaires 2 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

enhancement needs-design parameters
Langage dominant
JavaScript
Étoiles
6k
Forks
458
Merge moyen
1 j 9 h
PR mergées (30 j)
41

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript, r
Domaine
tooling
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.