functions to modify qmd for specific exports

This commit is contained in:
Andreas Gammelgaard Damsbo 2024-11-23 10:07:26 +01:00
commit d71d6169ff
No known key found for this signature in database
17 changed files with 246 additions and 29 deletions

View file

@ -24,15 +24,13 @@ getfun <- function(x) {
#' Wrapper to save data in RDS, load into specified qmd and render
#'
#' @param data list to pass to qmd
#' @param fileformat output format. Ignored if file!=NULL
#' @param qmd.file qmd file to render. Default is 'here::here("report.qmd")'
#' @param ... Passed to `quarto::quarto_render()`
#'
#' @return output file name
#' @export
#'
write_quarto <- function(data,fileformat=c("html","docx","odt","pdf","all"),qmd.file=here::here("report.qmd"),...){
fileformat <- match.arg(fileformat)
write_quarto <- function(data,...){
# Exports data to temporary location
#
# I assume this is more secure than putting it in the www folder and deleting
@ -43,9 +41,7 @@ write_quarto <- function(data,fileformat=c("html","docx","odt","pdf","all"),qmd.
## Specifying a output path will make the rendering fail
## Ref: https://github.com/quarto-dev/quarto-cli/discussions/4041
## Outputs to the same as the .qmd file
quarto::quarto_render(qmd.file,
output_format = fileformat,
execute_params = list(data.file=temp),
quarto::quarto_render(execute_params = list(data.file=temp),
...
)
}