Skip to content

Commit

Permalink
close #2376: no-op on invalid dependson values, and issue a warning
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Nov 4, 2024
1 parent ec7715c commit a4a8288
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

- If a character value is passed to the chunk option `message` or `warning`, it will be coerced by `as.logical()`, e.g., a character string `"NA"` will be coerced to `NA` (thanks, @cderv, #2375).

- Issue a warning when the chunk option `dependson` receives an invalid value (thanks, @otoomet, #2376).

- Changed the format of the reference card from PDF to HTML so building this package will not require LaTeX. See `vignette('knitr-refcard', package = 'knitr')`.

- Switched the vignette engine from **knitr** to `litedown::vignette` for some package vignettes.
Expand Down
5 changes: 3 additions & 2 deletions R/parser.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ parse_block = function(code, header, params.src, markdown_mode = out_format('mar
deps[deps < 0] = length(.knitEnv$labels) + deps[deps < 0]
deps = .knitEnv$labels[deps[deps > 0]]
}
for (i in deps)
dep_list$set(setNames(list(c(dep_list$get(i), label)), i))
if (is.character(deps)) {
for (i in deps) dep_list$set(setNames(list(c(dep_list$get(i), label)), i))
} else warning2("Invalid chunk option 'dependson' (must be character or numeric)")
}

# for quarto only
Expand Down

0 comments on commit a4a8288

Please sign in to comment.