Skip to content

Commit

Permalink
Tidy up render documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
awunderground committed Jun 26, 2023
1 parent 24a7ab5 commit 6b1e54b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions R/quarto_render_wrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@

quarto_render_wrapper <- function(input, output_file, execute_params, dir_name) {

# we must render the pages in the top-level directory because of changes to
# quarto
# we render all files in the top-level directory and then copy the needed
# files to the destination directory
# delete directory and contents if it exists

# delete the directory if it exists
if (dir.exists(dir_name)) {

unlink(dir_name, recursive = TRUE)
Expand Down Expand Up @@ -66,6 +61,8 @@ quarto_render_wrapper <- function(input, output_file, execute_params, dir_name)
to = paste0(dir_name, "_quarto.yml")
)

# render the quarto document in the new directory
# rendering in the top level directory and then copying does not work
xfun::in_dir(
dir = dir_name,
expr = quarto_render(
Expand All @@ -75,9 +72,10 @@ quarto_render_wrapper <- function(input, output_file, execute_params, dir_name)
)
)

# delete extra files
file.remove(paste0(dir_name, "search.json"))
file.remove(paste0(dir_name, "index.qmd"))


}


0 comments on commit 6b1e54b

Please sign in to comment.