Skip to content

Commit

Permalink
Merge pull request #364 from Tynes-Science/gh256-issuefix-cannot-load…
Browse files Browse the repository at this point in the history
…-custom-template

Correct report generation to use custom template
  • Loading branch information
mattfidler committed May 31, 2023
2 parents 4de1ab6 + 3a06bc3 commit a9ba7d1
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions R/pmx-report.R
Original file line number Diff line number Diff line change
Expand Up @@ -197,20 +197,26 @@ pmx_draft <- function(ctr, name, template, edit) {
# Copying template and skeleton files to subdirectories
invisible({
file.copy(
from=file.path(standing_file, "template.yaml"),
to=template_dir,
overwrite=TRUE,
recursive=TRUE
from = file.path(standing_file, "template.yaml"),
to = template_dir,
overwrite = TRUE,
recursive = TRUE
)
# Determine source of template file (variable may be a directory or a file)
template_source <-
if(grepl("\\.[A-z]{2,}$", template)) {
template
} else {
file.path(template, "skeleton", "skeleton.Rmd")
}

file.copy(
from=file.path(standing_file, "skeleton", "skeleton.Rmd"),
to=skeleton_dir,
overwrite=TRUE,
recursive=TRUE
from = template_source,
to = file.path(skeleton_dir, "skeleton.Rmd"),
overwrite = TRUE
)
})


res <- draft(
template_file,
template = template_dir,
Expand Down

0 comments on commit a9ba7d1

Please sign in to comment.