3  document2()

Diagram

Code
document2 <- function(my_folder = here::here("R"),
                      my_files = NULL,
                      out_name = "quarto",
                      ext_name = "document-fn",
                      output_format = "html",
                      book_yaml_lines = c("book:", paste0("  title: ", basename(here::here()))),
                      github_pages_prep = FALSE,
                      hide = NULL) {

1  if (is.null(my_files)) {
    my_files <- list.files(here::here("R"), full.names = T)
  }
  prerender_book(
    my_files = my_files,
    out_name = out_name,
    ext_name = ext_name,
    book_yaml_lines = book_yaml_lines,
    hide = hide
  )
2  all_results <- collect_all_metadata(out_name)
3  quarto::quarto_render(
    input = here::here(out_name),
    output_format = output_format,
    execute_params = list("all_results" = all_results),
    as_job = FALSE
  )
4  if (github_pages_prep) {
    assertthat::assert_that(
      !dir.exists(here::here("_book")),
      msg = "Folder _book already exists. Overwrite disabled"
    )
    assertthat::assert_that(
      !dir.exists(here::here("docs")),
      msg = "Folder docs already exists. Overwrite disabled"
    )
    file.copy(
      from = here::here("quarto/_book"),
      to = here::here(),
      overwrite = TRUE,
      recursive = TRUE,
      copy.mode = TRUE
    )
    file.rename(
      from = here::here("_book"),
      to = here::here("docs")
    )
  }
}
1
First step
2
Second step
3
Third step
4
Fourth step