R/check_pandoc.R

Defines functions check_pandoc

Documented in check_pandoc

#' check_pandoc
#' 
#' Support function which checks pandoc availability and stops with an error in case
#' that pandoc cannot be found
#' @param error boolean indicating whether function should throw an error in case of missing pandoc or return a boolean FALSE.
#' @return boolean indicating whether pandoc is available or not.
#' @author Jan Philipp Dietrich
#' @export

check_pandoc <- function(error=FALSE) {
  test <-try(system("pandoc --help",intern = TRUE, ignore.stderr = TRUE),silent = TRUE)
  if("try-error" %in% class(test)) {
    if(error) stop("pandoc not found. Please install pandoc and pandoc-citeproc first (https://pandoc.org/)!")
    return(FALSE)
  } 
  return(TRUE)
}

Try the goxygen package in your browser

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

goxygen documentation built on Aug. 16, 2020, 5:06 p.m.