Skip to content

Commit 26a809e

Browse files
authored
feat: add title to report in ReportDocument and trim separator (#330)
# Change description - Adds title to report document download files (for new ReportDocument class)
1 parent 88915bf commit 26a809e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

R/Reporter.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ Reporter <- R6::R6Class( # nolint: object_name_linter.
202202
#' reporter$append_cards(list(card1, card2))
203203
#' reporter$get_blocks()
204204
#'
205-
get_blocks = function(sep = "\n\n---\n\n\\newpage\n\n") {
205+
get_blocks = function(sep = "\n\\newpage\n") {
206206
cards <- self$get_cards()
207207
blocks <- list()
208208
for (idx in seq_along(cards)) {
@@ -212,8 +212,9 @@ Reporter <- R6::R6Class( # nolint: object_name_linter.
212212
if (idx != length(cards)) blocks <- append(blocks, sep)
213213
next # Easier to remove when ReportCard is fully deprecated
214214
}
215-
blocks <- append(blocks, unclass(card))
216-
if (idx != length(cards)) blocks <- append(blocks, sep)
215+
card_with_title <- c(report_document(sprintf("# %s", metadata(card, "title"))), card)
216+
blocks <- append(blocks, unclass(card_with_title))
217+
if (idx != length(cards)) blocks <- append(blocks, trimws(sep))
217218
}
218219
blocks
219220
},

man/Reporter.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)