[rkward] rkward/rbackend/rpackages/rkward: added rk.check_for_pandoc() function to rkward package
m.eik michalke
null at kde.org
Thu Oct 11 10:23:04 BST 2018
Git commit 3ad2f4c15182e85abcd98b073e76c58f92abfabb by m.eik michalke.
Committed on 11/10/2018 at 09:21.
Pushed by meikm into branch 'master'.
added rk.check_for_pandoc() function to rkward package
M +1 -0 rkward/rbackend/rpackages/rkward/NAMESPACE
A +27 -0 rkward/rbackend/rpackages/rkward/R/rk.check_for_pandoc.R
A +29 -0 rkward/rbackend/rpackages/rkward/man/rk.check_for_pandoc.Rd
https://commits.kde.org/rkward/3ad2f4c15182e85abcd98b073e76c58f92abfabb
diff --git a/rkward/rbackend/rpackages/rkward/NAMESPACE b/rkward/rbackend/rpackages/rkward/NAMESPACE
index 1d313fd6..23a207c6 100644
--- a/rkward/rbackend/rpackages/rkward/NAMESPACE
+++ b/rkward/rbackend/rpackages/rkward/NAMESPACE
@@ -57,6 +57,7 @@ export(rk.askYesNo)
export(rk.assign.preview.data)
export(rk.call.plugin)
export(rk.capture.output)
+export(rk.check_for_pandoc)
export(rk.clear.plot.history)
export(rk.demo)
export(rk.describe.alternative)
diff --git a/rkward/rbackend/rpackages/rkward/R/rk.check_for_pandoc.R b/rkward/rbackend/rpackages/rkward/R/rk.check_for_pandoc.R
new file mode 100644
index 00000000..b32d51fa
--- /dev/null
+++ b/rkward/rbackend/rpackages/rkward/R/rk.check_for_pandoc.R
@@ -0,0 +1,27 @@
+#' Check for pandoc installation and its features
+#'
+#' This function looks for a pandoc installation and if found, gathers information
+#' on its path, supported output formats, and the version number. It has no parameters.
+#'
+#' @return A named list with at least the boolean element \code{available}, and if
+#' that is \code{TRUE}, also the character vectors \code{path}, \code{output_formats}, and \code{version}.
+#' @author Meik Michalke \email{rkward-devel@@kde.org}
+#' @seealso \code{\link{rk.sessionInfo}}
+#' @keywords utilities misc
+#' @export
+#' @rdname rk.check_for_pandoc
+#' @examples
+#'
+#' rk.check_for_pandoc()
+
+"rk.check_for_pandoc" <- function(){
+ pandoc <- list(available=FALSE)
+ pandoc_path <- Sys.which("pandoc")[["pandoc"]]
+ if(!"" %in% pandoc_path){
+ pandoc[["path"]] <- pandoc_path
+ pandoc[["available"]] <- TRUE
+ pandoc[["output_formats"]] <- system("pandoc --list-output-formats", intern=TRUE)
+ pandoc[["version"]] <- gsub("[[:space:]]*pandoc[[:space:]]*", "", system("pandoc --version", intern=TRUE)[1])
+ } else {}
+ return(pandoc)
+}
diff --git a/rkward/rbackend/rpackages/rkward/man/rk.check_for_pandoc.Rd b/rkward/rbackend/rpackages/rkward/man/rk.check_for_pandoc.Rd
new file mode 100644
index 00000000..3da33f34
--- /dev/null
+++ b/rkward/rbackend/rpackages/rkward/man/rk.check_for_pandoc.Rd
@@ -0,0 +1,29 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rk.check_for_pandoc.R
+\name{rk.check_for_pandoc}
+\alias{rk.check_for_pandoc}
+\title{Check for pandoc installation and its features}
+\usage{
+rk.check_for_pandoc()
+}
+\value{
+A named list with at least the boolean element \code{available}, and if
+ that is \code{TRUE}, also the character vectors \code{path}, \code{output_formats},
+ and \code{version}.
+}
+\description{
+This function looks for a pandoc installation and if found, gathers information
+on its path, supported output formats, and the version number. It has no parameters.
+}
+\examples{
+
+rk.check_for_pandoc()
+}
+\seealso{
+\code{\link{rk.sessionInfo}}
+}
+\author{
+Meik Michalke \email{rkward-devel at kde.org}
+}
+\keyword{misc}
+\keyword{utilities}
More information about the rkward-tracker
mailing list