Skip to content

Commit

Permalink
internals: move unit to the end of args
Browse files Browse the repository at this point in the history
- avoid breaking code for those who don't name their args
  • Loading branch information
davidgohel committed Nov 19, 2024
1 parent 469fc11 commit c79f2c0
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: officer
Title: Manipulation of Microsoft Word and PowerPoint Documents
Version: 0.6.8.002
Version: 0.6.8.003
Authors@R: c(
person("David", "Gohel", , "[email protected]", role = c("aut", "cre")),
person("Stefan", "Moog", , "[email protected]", role = "aut"),
Expand Down
10 changes: 5 additions & 5 deletions R/docx_add.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ body_add_break <- function(x, pos = "after") {
#'
#' print(doc, target = tempfile(fileext = ".docx"))
#' @family functions for adding content
body_add_img <- function(x, src, style = NULL, width, height, unit = "in", pos = "after") {
body_add_img <- function(x, src, style = NULL, width, height, pos = "after", unit = "in") {
if (is.null(style)) {
style <- x$default_styles$paragraph
}
Expand Down Expand Up @@ -151,7 +151,7 @@ body_add_docx <- function(x, src, pos = "after") {
#' }
#' @family functions for adding content
#' @importFrom ragg agg_png
body_add_gg <- function(x, value, width = 6, height = 5, unit = "in", res = 300, style = "Normal", scale = 1, pos = "after", ...) {
body_add_gg <- function(x, value, width = 6, height = 5, res = 300, style = "Normal", scale = 1, pos = "after", unit = "in", ...) {
if (!requireNamespace("ggplot2")) {
stop("package ggplot2 is required to use this function")
}
Expand Down Expand Up @@ -417,7 +417,7 @@ body_add_toc <- function(x, level = 3, pos = "after", style = NULL, separator =
#'
#' print(doc, target = tempfile(fileext = ".docx"))
#' @family functions for adding content
body_add_plot <- function(x, value, width = 6, height = 5, unit = "in", res = 300, style = "Normal", pos = "after", ...) {
body_add_plot <- function(x, value, width = 6, height = 5, res = 300, style = "Normal", pos = "after", unit = "in", ...) {
unit <- check_unit(unit, c("in", "cm", "mm"))

file <- tempfile(fileext = ".png")
Expand Down Expand Up @@ -924,7 +924,7 @@ body_add.run_columnbreak <- function(x, value, style = NULL, ...) {
#' arguments are expressed: "in", "cm" or "mm".
#' @param res resolution of the png image in ppi
#' @param scale Multiplicative scaling factor, same as in ggsave
body_add.gg <- function(x, value, width = 6, height = 5, unit = "in", res = 300, style = "Normal", scale = 1, ...) {
body_add.gg <- function(x, value, width = 6, height = 5, res = 300, style = "Normal", scale = 1, unit = "in", ...) {
if (!requireNamespace("ggplot2")) {
stop("package ggplot2 is required to use this function")
}
Expand All @@ -943,7 +943,7 @@ body_add.gg <- function(x, value, width = 6, height = 5, unit = "in", res = 300,

#' @export
#' @describeIn body_add add a base plot with a [plot_instr] object.
body_add.plot_instr <- function(x, value, width = 6, height = 5, unit = "in", res = 300, style = "Normal", ...) {
body_add.plot_instr <- function(x, value, width = 6, height = 5, res = 300, style = "Normal", unit = "in", ...) {
unit <- check_unit(unit, c("in", "cm", "mm"))

file <- tempfile(fileext = ".png")
Expand Down
10 changes: 5 additions & 5 deletions man/body_add.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/body_add_gg.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/body_add_img.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/body_add_plot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c79f2c0

Please sign in to comment.