diff --git a/DESCRIPTION b/DESCRIPTION index feb0444..dd88b6c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,6 +23,7 @@ Encoding: UTF-8 LazyData: true Imports: bookdown, + officedown, knitr, rmarkdown, ggplot2, @@ -34,7 +35,7 @@ Imports: sysfonts, showtext Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.3 VignetteBuilder: knitr URL: https://github.com/nafc-assess/NAFOdown BugReports: https://github.com/nafc-assess/NAFOdown/issues diff --git a/NAMESPACE b/NAMESPACE index 3df74d6..be96ecf 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -13,13 +13,17 @@ export(plot_lengths) export(theme_nafo) export(theme_nafotabs) export(word_scr) +export(word_scr2) export(word_scs) +export(word_scs2) export(word_stacfis) +export(word_stacfis2) import(bookdown) import(flextable) import(ggplot2) import(ggridges) import(ggthemes) +import(officedown) import(showtext) importFrom(magrittr,"%>%") importFrom(officer,fp_border) diff --git a/NEWS.md b/NEWS.md index 05052c5..1a8f3f6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,3 +4,4 @@ - Adapted csasdown for NAFO documents - Added a ggplot and flextable themes for producing plots and tables that comply with NAFO plotting guidelines - Added a function for producing ridge plots from annual length frequency data +- Enable the use of bookdown::word_document2 or officedown::rdocx_document to build Word documents (see ?word_scr) diff --git a/R/utils.R b/R/utils.R index c36c693..187bd6a 100644 --- a/R/utils.R +++ b/R/utils.R @@ -15,25 +15,37 @@ #' #' This is a function called in output in the YAML of the driver Rmd file #' to specify the creation of a Microsoft Word version of an SCR, STACFIC -#' or SCS report. +#' or SCS report. Functions with 2 as a suffix are built using +#' [officedown::rdocx_document()], allowing users to leverage more in depth +#' customization of Word output. #' -#' @param ... arguments to pass to [bookdown::word_document2()] +#' @param ... arguments to pass to [bookdown::word_document2()] or [officedown::rdocx_document()] +#' for functions with 2 as a suffix. #' #' @return A Word Document based on the NAFO SCR, STACFIC or SCS word template. #' #' @import bookdown +#' @import officedown #' @rdname word_scr #' @export -#' word_scr <- .make_word_function(bookdown::word_document2, "SCR_template.docx") #' @rdname word_scr #' @export -#' +word_scr2 <- .make_word_function(officedown::rdocx_document, "SCR_template.docx") + +#' @rdname word_scr +#' @export word_stacfis <- .make_word_function(bookdown::word_document2, "STACFIS_template.docx") #' @rdname word_scr #' @export -#' +word_stacfis2 <- .make_word_function(officedown::rdocx_document, "STACFIS_template.docx") + +#' @rdname word_scr +#' @export word_scs <- .make_word_function(bookdown::word_document2, "SCS_template.docx") +#' @rdname word_scr +#' @export +word_scs2 <- .make_word_function(officedown::rdocx_document, "SCS_template.docx") diff --git a/man/word_scr.Rd b/man/word_scr.Rd index 5dfe8be..9865ada 100644 --- a/man/word_scr.Rd +++ b/man/word_scr.Rd @@ -2,18 +2,28 @@ % Please edit documentation in R/utils.R \name{word_scr} \alias{word_scr} +\alias{word_scr2} \alias{word_stacfis} +\alias{word_stacfis2} \alias{word_scs} +\alias{word_scs2} \title{Creates an R Markdown Word NAFO-formatted document} \usage{ word_scr(...) +word_scr2(...) + word_stacfis(...) +word_stacfis2(...) + word_scs(...) + +word_scs2(...) } \arguments{ -\item{...}{arguments to pass to \code{\link[bookdown:html_document2]{bookdown::word_document2()}}} +\item{...}{arguments to pass to \code{\link[bookdown:html_document2]{bookdown::word_document2()}} or \code{\link[officedown:rdocx_document]{officedown::rdocx_document()}} +for functions with 2 as a suffix.} } \value{ A Word Document based on the NAFO SCR, STACFIC or SCS word template. @@ -21,5 +31,7 @@ A Word Document based on the NAFO SCR, STACFIC or SCS word template. \description{ This is a function called in output in the YAML of the driver Rmd file to specify the creation of a Microsoft Word version of an SCR, STACFIC -or SCS report. +or SCS report. Functions with 2 as a suffix are built using +\code{\link[officedown:rdocx_document]{officedown::rdocx_document()}}, allowing users to leverage more in depth +customization of Word output. }