Skip to content

Commit

Permalink
fix: correct pandoc version comparison in knit_print.dml() function
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgohel committed Sep 2, 2023
1 parent a831d92 commit 45bd250
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: officedown
Type: Package
Title: Enhanced 'R Markdown' Format for 'Word' and 'PowerPoint'
Version: 0.3.0
Version: 0.3.1.001
Authors@R: c(
person("David", "Gohel", role = c("aut", "cre", "cph"),
email = "[email protected]"),
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# officedown 0.3.1

## issues

- Compliance of pandoc version comparison in `knit_print.dml()` function
following CRAN e-mail.

# officedown 0.3.0

## new feature
Expand Down
2 changes: 1 addition & 1 deletion R/knit_print_dml.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @importFrom rlang eval_tidy
#' @noRd
knit_print.dml <- function(x, ...) {
if (pandoc_version() < 2.4) {
if (pandoc_version() < numeric_version("2.4")) {
stop("pandoc version >= 2.4 required for DrawingML output in pptx")
}

Expand Down
Binary file modified tests/testthat/_snaps/rdocx-lists/lists.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified tests/testthat/_snaps/rdocx-plots/plot-basic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/rdocx-sections/all-sections.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/rdocx-sections/docx-sections.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/rdocx-tables/docx-tables-basic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 0 additions & 7 deletions tests/testthat/test-rdocx-par-settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ test_that("scanning settings", {
expect_equal(xml_attr(spacing_node, "line"), "240")
})

test_that("visual testing", {
testthat::skip_if_not_installed("doconv")
testthat::skip_if_not(doconv::msoffice_available())
library(doconv)
expect_snapshot_doc(x = docx_file, name = "par-settings", engine = "testthat")
})

docx_file <- tempfile(fileext = ".docx")
render_rmd("rmd/change-styles.Rmd", output_file = docx_file)

Expand Down
9 changes: 7 additions & 2 deletions tests/testthat/test-rdocx-plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ skip_if_not(pandoc_version() >= numeric_version("2"))

source("utils.R")

docx_file <- tempfile(fileext = ".docx")
render_rmd("rmd/plot-basic.Rmd", output_file = docx_file)

test_that("reading captions", {

docx_file <- tempfile(fileext = ".docx")
render_rmd("rmd/plot-basic.Rmd", output_file = docx_file)

node_body <- get_docx_xml(docx_file)

expect_equal(
Expand All @@ -27,5 +29,8 @@ test_that("visual testing plots", {
testthat::skip_if_not_installed("doconv")
testthat::skip_if_not(doconv::msoffice_available())
library(doconv)
docx_file <- tempfile(fileext = ".docx")
render_rmd("rmd/plot-basic.Rmd", output_file = docx_file)

expect_snapshot_doc(x = docx_file, name = "plot-basic", engine = "testthat")
})

0 comments on commit 45bd250

Please sign in to comment.