Skip to content

Commit

Permalink
Fix accidental knitr dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
hughjonesd committed Feb 5, 2024
1 parent 725718a commit 5a3edc0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/aaa-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,12 @@ get_caption_hpos <- function (ht) {

make_label <- function (ht) {
lab <- label(ht)
chunk_label <- knitr::opts_current$get("label")

has_knitr <- requireNamespace("knitr", quietly = TRUE)
chunk_label <- if (has_knitr) knitr::opts_current$get("label") else NULL
if (is.na(lab) &&
getOption("huxtable.autolabel", TRUE) &&
requireNamespace("knitr", quietly = TRUE) &&
has_knitr &&
! is.null(chunk_label)) {
lab <- paste0("tab:", chunk_label)
}
Expand Down

0 comments on commit 5a3edc0

Please sign in to comment.