Skip to content

Commit

Permalink
also allow tinytable
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Mar 13, 2024
1 parent 8c19f0b commit e1f85dd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
24 changes: 24 additions & 0 deletions R/print_html.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ print_html.compare_parameters <- function(x,
font_size = "100%",
line_padding = 4,
column_labels = NULL,
engine = "gt",
...) {
# check if user supplied digits attributes
if (missing(digits)) {
Expand All @@ -169,6 +170,29 @@ print_html.compare_parameters <- function(x,
select <- attributes(x)$output_style
}

# markdown engine?
engine <- match.arg(engine, c("gt", "default", "tt"))

# for tiny table, we can just call print_md()
if (engine == "tt") {
return(print_md(
x,
digits = digits,
ci_digits = ci_digits,
p_digits = p_digits,
caption = caption,
subtitle = subtitle,
footer = footer,
select = select,
split_components = TRUE,
ci_brackets = ci_brackets,
zap_small = zap_small,
groups = groups,
engine = "tt",
outformat = "html"
))
}

# we need glue-like syntax right now...
select <- .convert_to_glue_syntax(style = select, "<br>")

Expand Down
10 changes: 9 additions & 1 deletion R/print_md.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,20 @@ print_md.compare_parameters <- function(x,
)

if (identical(engine, "tt")) {
# retrieve output format - print_md() may be called from print_html()
dots <- list(...)
if (identical(dots$outformat, "html")) {
outformat <- "html"
} else {
outformat <- "markdown"
}
.export_table_tt(
x,
formatted_table,
groups,
caption = caption,
footer = footer
footer = footer,
outformat = outformat
)
} else {
insight::export_table(
Expand Down

0 comments on commit e1f85dd

Please sign in to comment.