Skip to content

Commit

Permalink
Tabularray inner end (#390)
Browse files Browse the repository at this point in the history
* bump

* Typst & Quarto

* tabularray_inner at the end of styles

* snapshots
  • Loading branch information
vincentarelbundock authored Dec 13, 2024
1 parent d462e19 commit dd0ae48
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Bugs:
* Typst notes returned an error since the last release. Thanks to @DominikVogel for report #357.
* Duplicate group labels are allowed in LaTeX with `group_tt()`. Thanks to @eeemda for report #362.


## 0.5.0

New:
Expand Down
17 changes: 9 additions & 8 deletions R/style_tabularray.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ setMethod(
sty$alignv[which(sty$alignv == "t")] <- "h"
sty$alignv[which(sty$alignv == "m")] <- "m"

for (spec in stats::na.omit(sty$tabularray_inner)) {
x@table_string <- tabularray_insert(x@table_string, content = spec, type = "inner")
}

for (spec in stats::na.omit(sty$tabularray_outer)) {
x@table_string <- tabularray_insert(x@table_string, content = spec, type = "inner")
}

set <- span <- rep("", nrow(rec))

# d-column are column-wise, so we treat them here
Expand Down Expand Up @@ -240,6 +232,15 @@ setMethod(
x@table_string <- tabularray_insert(x@table_string, content = s, type = "inner")
}

for (spec in unique(stats::na.omit(sty$tabularray_inner))) {
x@table_string <- tabularray_insert(x@table_string, content = spec, type = "inner")
}

for (spec in unique(stats::na.omit(sty$tabularray_outer))) {
x@table_string <- tabularray_insert(x@table_string, content = spec, type = "inner")
}


return(x)
}
)
Expand Down
6 changes: 1 addition & 5 deletions inst/tinytest/_tinysnapshot/latex-theme_grid.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
{ %% tabularray inner open
colspec={Q[]Q[]Q[]Q[]Q[]},
hlines, vlines,
hlines, vlines,
hlines, vlines,
hlines, vlines,
hlines, vlines,
} %% tabularray inner close
mpg & cyl & disp & hp & drat \\
21.0 & 6 & 160 & 110 & 3.90 \\
21.0 & 6 & 160 & 110 & 3.90 \\
22.8 & 4 & 108 & 93 & 3.85 \\
22.8 & 4 & 108 & 93 & 3.85 \\
21.4 & 6 & 258 & 110 & 3.08 \\
\end{tblr}
\end{table}
8 changes: 2 additions & 6 deletions inst/tinytest/_tinysnapshot/latex-theme_striped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,15 @@
] %% tabularray outer close
{ %% tabularray inner open
colspec={Q[]Q[]Q[]Q[]Q[]},
row{even}={bg=black!5!white},
row{even}={bg=black!5!white},
row{even}={bg=black!5!white},
row{even}={bg=black!5!white},
row{even}={bg=black!5!white},
row{2,4}={}{bg=cededed,},
row{even}={bg=black!5!white},
} %% tabularray inner close
\tinytableDefineColor{cededed}{HTML}{ededed}
\toprule
mpg & cyl & disp & hp & drat \\ \midrule %% TinyTableHeader
21.0 & 6 & 160 & 110 & 3.90 \\
21.0 & 6 & 160 & 110 & 3.90 \\
22.8 & 4 & 108 & 93 & 3.85 \\
22.8 & 4 & 108 & 93 & 3.85 \\
21.4 & 6 & 258 & 110 & 3.08 \\
\bottomrule
\end{tblr}
Expand Down

0 comments on commit dd0ae48

Please sign in to comment.