From 4653580ddb026c42560b0b8e38184f0e12e78cb7 Mon Sep 17 00:00:00 2001 From: kartikeya Date: Thu, 21 Sep 2023 18:54:58 +0530 Subject: [PATCH] fixing issue with quoting the string. --- R/Renderer.R | 4 ++-- R/utils.R | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/R/Renderer.R b/R/Renderer.R index 8fc858ee..3340a75a 100644 --- a/R/Renderer.R +++ b/R/Renderer.R @@ -39,7 +39,7 @@ Renderer <- R6::R6Class( # nolint: object_name_linter. "\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(%s)\n%s\n```\n", capture.output(dput(global_knitr)), if (identical(private$report_type, "powerpoint_presentation")) { - paste(capture.output(code_block_function), collapse = "\n") + paste0("code_block <- ", paste(deparse(format_code_block_for_slide), collapse = "\n")) } else { character(0) } @@ -132,7 +132,7 @@ Renderer <- R6::R6Class( # nolint: object_name_linter. paste( sprintf( "---\n\n```{r, echo=FALSE}\ncode_block(\n%s)\n```\n", - shQuote(block_content_lst) + sQuote(block_content_lst, q = FALSE) ), collapse = "\n\n" ) diff --git a/R/utils.R b/R/utils.R index 88533e78..1b0e7abc 100644 --- a/R/utils.R +++ b/R/utils.R @@ -168,6 +168,7 @@ to_flextable <- function(content) { #' #' @keywords internal custom_theme <- function(ft) { + checkmate::assert_class(ft, "flextable") ft <- flextable::fontsize(ft, size = 8, part = "body") ft <- flextable::bold(ft, part = "header") ft <- flextable::theme_booktabs(ft) @@ -267,7 +268,7 @@ split_text_block <- function(x, n) { #' @noRd #' #' @keywords internal -code_block_function <- function(code_block) { +format_code_block_for_slide <- function(code_block) { df <- data.frame(code_block) ft <- flextable::flextable(df) ft <- flextable::delete_part(ft, part = "header")