From: Fuad Muhic Date: Tue, 17 Apr 2018 15:10:04 +0000 (+0200) Subject: Added script to generate html doc for .Rmd files. X-Git-Tag: 1.2.0~202^2~2 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/274124d082f7268fbe3b3d5e0608a3f4b6ae68ac Added script to generate html doc for .Rmd files. Arvados-DCO-1.1-Signed-off-by: Fuad Muhic --- diff --git a/sdk/R/createDoc.R b/sdk/R/createDoc.R new file mode 100644 index 0000000000..8d4c5ba042 --- /dev/null +++ b/sdk/R/createDoc.R @@ -0,0 +1,19 @@ +#Run script with $Rscript createDoc.R input.Rmd output.html + +require(knitr) # required for knitting from rmd to md +require(markdown) # required for md to html + +args <- commandArgs(TRUE) + +if(length(args) != 2) + stop("Please provide 2 arguments corresponding to input and output file!") + +inputFile <- args[[1]] # .Rmd file +outputFile <- args[[2]] # .html file + +# Create and fill temp .md file from existing .Rmd file +tempMdFile <- tempfile("tempREADME", fileext = "md") +knitr::knit(inputFile, tempMdFile) + +# Generate HTML from temporary .md file +markdown::markdownToHTML(tempMdFile, outputFile)