NewGraphEnvironment/fish_passage_skeena_2022_reporting

leave links to maps and data as Attachments in table of contents of gitbook

Closed this issue · 3 comments

nice and easy to find yo

Added the simple chapters that point to the location of maps and data

Now - instead of

rmarkdown::render_site(output_format = 'bookdown::gitbook',
                       encoding = 'UTF-8')

we run

{
  # These files are included in the gitbook version already so we move them out of the build
  files_to_move <- list.files(pattern = ".Rmd$") %>%
    stringr::str_subset(., '2300', negate = F) #move the attachments out
  files_destination <- paste0('hold/', files_to_move)

  ##move the files
  mapply(file.rename, from = files_to_move, to = files_destination)

  rmarkdown::render_site(output_format = 'bookdown::gitbook',
                         encoding = 'UTF-8')

  ##move the files from the hold file back to the main file
  mapply(file.rename, from = files_destination, to = files_to_move)
}

slightly weird because we end up with no Attachment 2 but can pull a

`r if(gitbook_on){knitr::asis_output("**Attachment 2 - Habitat Assessment Data**")} else knitr::asis_output("**Attachment 3 - Habitat Assessment Data**")`