R/nettskjemar-package.R

Defines functions knit_vignettes release_bullets

#' @keywords internal
"_PACKAGE"

## quiets concerns of R CMD check
if (getRversion() >= "2.15.1") {
  utils::globalVariables(c(
    "value"
  ))
}

# nocov start
release_bullets <- function() {
  c(
    sprintf(
      "Coverage is at: %s",
      covr::coverage_to_list(covr::package_coverage())$totalcoverage
    ),
    knit_vignettes()
  )
} # nocov end

# nocov start
knit_vignettes <- function() {
  proc <- list.files(
    "vignettes",
    "orig$",
    full.names = TRUE
  )

  lapply(proc, function(x) {
    fig_path <- "static"
    knitr::knit(
      x,
      gsub("\\.orig$", "", x)
    )
    imgs <- list.files(fig_path, full.names = TRUE)
    sapply(imgs, function(x) {
      file.copy(
        x,
        file.path("vignettes", fig_path, basename(x)),
        overwrite = TRUE
      )
    })
    invisible(unlink(fig_path, recursive = TRUE))
  })

  list(
    "Knit vignettes",
    sapply(proc, basename)
  )
} # nocov end

Try the nettskjemar package in your browser

Any scripts or data that you put into this service are public.

nettskjemar documentation built on June 8, 2025, 10:20 a.m.