diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dda409..3c58d35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +**v1.3.1:** + +* Fixed bug in generating PDFs of RMarkdown files in `ottr::export` + +**v1.3.0:** + +* Added support for exporting PDFs in zip files created by `ottr:export` + **v1.2.0:** * Refactored structure of the package diff --git a/DESCRIPTION b/DESCRIPTION index 85aed29..64b028f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ottr Title: An R Autograding Extension for Otter-Grader -Version: 1.3.0 +Version: 1.3.1 Authors@R: c( person(given = "Christopher", family = "Pyles", @@ -16,7 +16,7 @@ Description: License: BSD_3_clause + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.1 +RoxygenNote: 7.2.3 Depends: R (>= 4.0.0) Imports: diff --git a/NAMESPACE b/NAMESPACE index a6cee70..df94e02 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -5,3 +5,5 @@ export(check) export(export) export(run_autograder) export(valid_syntax) +importFrom(R6,R6Class) +importFrom(jsonlite,toJSON) diff --git a/R/GradingResults.R b/R/GradingResults.R index f870ab7..d1a50d9 100644 --- a/R/GradingResults.R +++ b/R/GradingResults.R @@ -44,6 +44,8 @@ GradingResults <- R6::R6Class( #' @description Export these results to a JSON string. #' + #' @importFrom jsonlite toJSON + #' #' @return The JSON string to_json = function() { return(jsonlite::toJSON(self$to_list(), auto_unbox = TRUE, pretty = TRUE, null = "null")) diff --git a/R/TestCase.R b/R/TestCase.R index e332b6f..f27bc68 100644 --- a/R/TestCase.R +++ b/R/TestCase.R @@ -9,6 +9,8 @@ #' @field success_message A message to show to students if the test passes #' @field failure_message A message to show to students if the test fails #' +#' @importFrom R6 R6Class +#' #' @export #' #' @examples diff --git a/R/export.R b/R/export.R index 6390b99..17adb92 100644 --- a/R/export.R +++ b/R/export.R @@ -45,7 +45,7 @@ export <- function(submission_path, export_path = NULL, display_link = TRUE, pdf readLines(submission_path)) writeLines(contents, new_subm_path) - rmarkdown::render(new_subm_path, "pdf_document", pdf_path) + rmarkdown::render(new_subm_path, "pdf_document", pdf_path, dirname(submission_path)) file.remove(new_subm_path) } else { stop("Only Rmd and ipynb files can be converted to PDFs") @@ -63,7 +63,7 @@ export <- function(submission_path, export_path = NULL, display_link = TRUE, pdf file.remove(zip_filename_file_name) - if (display_link) { + if (display_link && Sys.getenv("RSTUDIO") != "1") { IRdisplay::display_html(sprintf("

Your submission has been exported. Click here to download the zip file.

diff --git a/tests/testthat/test_export.R b/tests/testthat/test_export.R index 1825859..8691cab 100644 --- a/tests/testthat/test_export.R +++ b/tests/testthat/test_export.R @@ -100,5 +100,5 @@ test_that("supports PDF exports for Rmd files", { # check that IRdisplay::display_html was called expect_called(mock_render, 1) - expect_args(mock_render, 1, tempfile_path, "pdf_document", pdf_path) + expect_args(mock_render, 1, tempfile_path, "pdf_document", pdf_path, dirname(subm_path)) })