Skip to content

Commit

Permalink
tests pass, but they are limited
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Jan 16, 2024
1 parent 08fd030 commit 5361c67
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions R/style_tabularray.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ style_tabularray <- function(x,
out <- x

ival <- if (is.null(i)) seq_len(meta(x, "nrows")) else i
jval <- if (is.null(j)) seq_len(meta(x, "ncols")) else i
jval <- if (is.null(j)) seq_len(meta(x, "ncols")) else j

# order may be important for recycling
settings <- expand.grid(i = ival, j = jval, tabularray = "")
Expand All @@ -33,14 +33,18 @@ style_tabularray <- function(x,
# colspan requires cell level, so we keep the full settings DF
if (is.null(colspan)) {
if (is.null(i) && is.null(j)) {
settings <- unique(settings[, "i", drop = FALSE])
settings <- unique(settings[, c("i", "tabularray"), drop = FALSE])
} else if (is.null(i)) {
settings <- unique(settings[, "j", drop = FALSE])
settings <- unique(settings[, c("j", "tabularray"), drop = FALSE])
} else if (is.null(j)) {
settings <- unique(settings[, "i", drop = FALSE])
settings <- unique(settings[, c("i", "tabularray"), drop = FALSE])
}
}

if (!isTRUE(header) && "i" %in% names(settings)) {
settings$i <- settings$i + meta(out, "nhead")
}

span <- if (!is.null(colspan)) paste0("c=", colspan, ",") else ""

# convert to tabularray now that we've filled the bootstrap settings
Expand Down

0 comments on commit 5361c67

Please sign in to comment.