Skip to content

Commit

Permalink
Merge pull request #263 from pbs-assess/dandev
Browse files Browse the repository at this point in the history
use Word templates for 2024 for ResDoc
  • Loading branch information
ricardd authored Nov 26, 2024
2 parents 6d401c6 + 6b23167 commit cdc28c9
Show file tree
Hide file tree
Showing 17 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion R/resdoc-word.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' template
#' @export
resdoc_word <- function(...) {
file <- if (fr()) "RES2021-fra-content.docx" else "RES2021-eng-content.docx"
file <- if (fr()) "RES2024-fra-content.docx" else "RES2024-eng-content.docx"
base <- word_document2(...,
reference_docx = system.file("csas-docx",
file,
Expand Down
2 changes: 1 addition & 1 deletion R/sr-word.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' @rdname csas_docx
#' @export
sr_word <- function(...) {
file <- if (fr()) "SRR-RS2021-fra.docx" else "SRR-RS2021-eng.docx"
file <- if (fr()) "SRR-RS2024-fra.docx" else "SRR-RS2024-eng.docx"
base <- word_document2(...,
reference_docx = system.file("csas-docx",
file,
Expand Down
10 changes: 5 additions & 5 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ tr <- function(x, ...){
# nocov start
#' Add a Res Doc titlepage to a docx file
#'
#' Add a Res Doc titlepage. Must hand edit `templates/RES2021-eng-titlepage.docx`
#' Add a Res Doc titlepage. Must hand edit `templates/RES2024-eng-titlepage.docx`
#' to have your desired title and authors etc.
#'
#' @param titlepage Filename
Expand All @@ -325,7 +325,7 @@ tr <- function(x, ...){
#' @return A merged .docx
#' @importFrom officer read_docx body_add_docx cursor_reach body_add_toc
#' @export
add_resdoc_docx_titlepage <- function(titlepage = "templates/RES2021-eng-titlepage.docx",
add_resdoc_docx_titlepage <- function(titlepage = "templates/RES2024-eng-titlepage.docx",
resdoc = "_book/resdoc-english.docx") {
title_doc <- read_docx(titlepage)
x <- body_add_docx(title_doc, resdoc, pos = "before")
Expand All @@ -335,15 +335,15 @@ add_resdoc_docx_titlepage <- function(titlepage = "templates/RES2021-eng-titlepa
#' Add front matter to Res Doc docx file
#'
#' Add title page and table of contents to a Res Doc. Must hand edit
#' `templates/RES2021-eng-frontmatter.docx`to have your desired title and authors etc.
#' `templates/RES2024-eng-frontmatter.docx`to have your desired title and authors etc.
#'
#' @param frontmatter Path to title page file included with resdoc template
#' @param resdoc Path to content generated using resdoc_word
#'
#' @return A merged .docx
#' @export
add_resdoc_docx_frontmatter <- function(frontmatter = "templates/RES2021-eng-frontmatter.docx",
resdoc = "_book/resdoc.docx") {
add_resdoc_docx_frontmatter <- function(frontmatter = "templates/RES2024-eng-frontmatter.docx",
resdoc = "_book/resdoc-english.docx") {
frontmatter_doc <- read_docx(frontmatter)
x <- body_add_docx(frontmatter_doc, resdoc, pos = "before")
x <- cursor_reach(x, keyword = "TABLE OF CONTENTS")
Expand Down
Binary file not shown.
Binary file not shown.
Binary file removed inst/csas-docx/RES2021-eng-content.docx
Binary file not shown.
Binary file added inst/csas-docx/RES2024-eng-content.docx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified inst/csas-docx/RES2024-eng.docx
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions inst/rmarkdown/templates/fsar/skeleton/skeleton.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ output:
csasdown::fsar_word
link-citations: false
bibliography: bib/refs.bib
csl: csl/csas.csl
# End of options to set
title: ""
knit: (function(input, ...) {
Expand Down

0 comments on commit cdc28c9

Please sign in to comment.