From a338bc471f9896a713e1830b42b2bfef656b6a8d Mon Sep 17 00:00:00 2001 From: Vincent Arel-Bundock Date: Sun, 14 Jan 2024 14:30:16 -0500 Subject: [PATCH] minor --- R/style_tt.R | 10 ++++++++-- vignettes/tutorial.qmd | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/R/style_tt.R b/R/style_tt.R index 17bc78f8..028ee1c8 100644 --- a/R/style_tt.R +++ b/R/style_tt.R @@ -161,20 +161,26 @@ style_tt <- function (x, i, j, bold = FALSE, italic = FALSE, monospace = FALSE, } if (!is.null(align)) { - align_bootstrap <- ifelse(align == "c", "center", align_bootstrap) + align_bootstrap <- ifelse(align == "c", "center", align) align_bootstrap <- ifelse(align == "l", "left", align_bootstrap) align_bootstrap <- ifelse(align == "r", "right", align_bootstrap) } else { align_bootstrap <- align } + if (!is.null(fontsize)) { + fontsize_bootstrap <- sprintf("%spx", (1 + 1 / 3) * fontsize) + } else { + fontsize_bootstrap <- fontsize + } + settings$bootstrap <- "" settings$bootstrap <- vectorize_bootstrap(settings$bootstrap, bold, "font-weight: bold;") settings$bootstrap <- vectorize_bootstrap(settings$bootstrap, italic, "font-style: italic;") settings$bootstrap <- vectorize_bootstrap(settings$bootstrap, underline, "text-decoration: underline;") settings$bootstrap <- vectorize_bootstrap(settings$bootstrap, strikeout, "text-decoration: line-through;") settings$bootstrap <- vectorize_bootstrap(settings$bootstrap, monospace, "font-family: monospace;") - settings$bootstrap <- vectorize_bootstrap(settings$bootstrap, fontsize, "font-size: %s;") + settings$bootstrap <- vectorize_bootstrap(settings$bootstrap, fontsize_bootstrap, "font-size: %s;") settings$bootstrap <- vectorize_bootstrap(settings$bootstrap, align_bootstrap, "text-align: %s;") settings$bootstrap <- vectorize_bootstrap(settings$bootstrap, color, "color: %s;") settings$bootstrap <- vectorize_bootstrap(settings$bootstrap, background, "background-color: %s;") diff --git a/vignettes/tutorial.qmd b/vignettes/tutorial.qmd index ee2fdd3b..9a1f5ad5 100644 --- a/vignettes/tutorial.qmd +++ b/vignettes/tutorial.qmd @@ -385,7 +385,7 @@ colnames(k) <- NULL bg <- hcl.colors(20, "Inferno") fs <- 1:20 -tt(k, "html", width = .5) |> +tt(k, width = .5) |> style_tt( i = 1:4, j = 1:5,