Skip to content

Commit

Permalink
Remove top left format override
Browse files Browse the repository at this point in the history
  • Loading branch information
edelarua committed Nov 15, 2023
1 parent 64ddddf commit b58e206
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions R/as_html.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,16 @@ as_html <- function(x,
cells <- matrix(rep(list(list()), (nlh + nrow(x)) * (nc)), ncol = nc)

for (i in seq_len(nrow(mat$strings))) {
# rows <- which(mat$line_grouping == i)
for (j in seq_len(ncol(mat$strings))) {
curstrs <- mat$strings[i, j]
curspn <- mat$spans[i, j]
algn <- mat$aligns[i, j]

inhdr <- i <= nlh
tagfun <- if (inhdr) tags$th else tags$td

cells[i, j][[1]] <- tagfun(
class = if (inhdr) class_th else class_tr,
class = if (j > 1 || i > nlh) paste0("text-", algn),
style = paste0("text-align: ", algn, ";"),
style = if (inhdr && !"header" %in% bold) "font-weight: normal;",
style = if (i == nlh && header_sep_line) "border-bottom: 1px solid black;",
colspan = if (curspn != 1) curspn,
Expand All @@ -102,16 +103,6 @@ as_html <- function(x,
}
}

## special casing hax for top_left. We probably want to do this better someday
cells[1:nlh, 1] <- mapply(
FUN = function(x, algn) {
tags$th(x, class = class_th, style = "white-space: pre;")
},
x = mat$strings[1:nlh, 1],
algn = mat$aligns[1:nlh, 1],
SIMPLIFY = FALSE
)

if (header_sep_line) {
cells[nlh][[1]] <- htmltools::tagAppendAttributes(
cells[nlh, 1][[1]],
Expand Down

0 comments on commit b58e206

Please sign in to comment.