Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main branch #4

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1b1945c
Remove test about `tab_row_group() from tab_style() (it is duplicated…
olivroy Jul 11, 2024
9d439c2
Refactor and simplify `tab_style()` tests.
olivroy Jul 11, 2024
3eb1500
Error early if rows don't exist #1535 + use string in resolver error …
olivroy Jul 11, 2024
121a4f3
Refactor tab_row_group() tests + use test helper
olivroy Jul 11, 2024
ee4d05b
Refactor tests + accept snapshots
olivroy Jul 11, 2024
f97e825
Add news
olivroy Jul 11, 2024
97f9e74
Update snapshots
olivroy Jul 11, 2024
14e9ddf
Ensure `md("")` will render in Quarto.
olivroy Jul 11, 2024
45ffcf9
Add `expect_no_match_html()`
olivroy Jul 11, 2024
74b6203
Move quarto function to own file.
olivroy Jul 11, 2024
fc531d4
Remove unused `dt_col_merge_init()`
olivroy Jul 12, 2024
74a90e5
Refactor all text transforming functions to use `text_transform_impl(…
olivroy Jul 12, 2024
b5e6972
inherit docs from main function
olivroy Jul 12, 2024
2167c74
Improve stack trace + add test for `text_*()` functions `locations` e…
olivroy Jul 12, 2024
41b6fce
Validate input with `check_string()` in `text_replace()` to avoid war…
olivroy Jul 12, 2024
7298e16
Add more tests to improve coverage.
olivroy Jul 12, 2024
7dae195
Merge pull request #1772 from olivroy/md-empty
rich-iannone Jul 12, 2024
7c0dc67
Merge branch 'master' into issue1535
rich-iannone Jul 12, 2024
37ad5a6
Merge pull request #1770 from olivroy/issue1535
rich-iannone Jul 12, 2024
9d7708c
Merge branch 'master' into cols-width-gtable
rich-iannone Jul 12, 2024
bf53121
Merge pull request #1774 from olivroy/cols-width-gtable
rich-iannone Jul 12, 2024
479a18e
deal with pct column widths
teunbrand Jul 12, 2024
139cf2e
add test
teunbrand Jul 12, 2024
8647895
add news bullet
teunbrand Jul 12, 2024
7caacc3
remove specious `grid::unit()`
teunbrand Jul 12, 2024
709ff07
Move `fmt()` into own file along with the utils for formatting.
olivroy Jul 12, 2024
99da74e
Align test name with R file.
olivroy Jul 12, 2024
89302de
Rename test files for consitency.
olivroy Jul 12, 2024
8670517
Merge test-rtf_column_widths.R into test-rtf_cols_width.R + update Rb…
olivroy Jul 12, 2024
f0bb9f9
Move `fmt_number()` and `fmt_integer()` into own file.
olivroy Jul 12, 2024
90883db
Reduce pipe usage [ci skip]
olivroy Jul 12, 2024
b3ff1d8
Merge pull request #1776 from teunbrand/pct_column_widths
rich-iannone Jul 12, 2024
a4a9482
Merge branch 'master' into fmt-change-file
rich-iannone Jul 12, 2024
8bd3f9c
Update man
olivroy Jul 12, 2024
84cd9d5
Merge pull request #1778 from olivroy/fmt-change-file
rich-iannone Jul 12, 2024
a88e0cc
Merge branch 'master' into refactor-gt-expectations
olivroy Jul 12, 2024
294c09c
Merge pull request #1777 from olivroy/refactor-gt-expectations
rich-iannone Jul 12, 2024
f1edfc0
Merge main branch
olivroy Jul 12, 2024
d9dadcf
Use double quotes
olivroy Jul 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ tests/testthat/test-cols_label_with.R
tests/testthat/test-cols_merge.R
tests/testthat/_snaps/cols_merge.md

tests/testthat/test-cols_width_rtf.R
tests/testthat/_snaps/cols_width_rtf.md

tests/testthat/test-cols_width.R
tests/testthat/_snaps/cols_width.md

Expand Down Expand Up @@ -110,6 +107,9 @@ tests/testthat/_snaps/image.md
tests/testthat/test-info_tables.R
tests/testthat/test-input_data_validation.R

tests/testthat/test-l_summary_rows.R
tests/testthat/_snaps/l_summary_rows.md

tests/testthat/test-l_table_parts.R
tests/testthat/_snaps/l_table_parts.md

Expand All @@ -124,20 +124,18 @@ tests/testthat/_snaps/removal_functions.md
tests/testthat/test-rows_add.R
tests/testthat/_snaps/rows_add.md

tests/testthat/test-rtf_column_widths.R
tests/testthat/test-rtf_cols_width.R
tests/testthat/_snaps/rtf_cols_width.md

tests/testthat/test-rtf_page_options.R
tests/testthat/_snaps/rtf_page_options.md

tests/testthat/test-rtf_summary_rows.R
tests/testthat/_snaps/rtf_summary_rows.md

tests/testthat/test-stub.R
tests/testthat/test-substitution.R

tests/testthat/test-summary_rows_latex.R
tests/testthat/_snaps/summary_rows_latex.md

tests/testthat/test-summary_rows_rtf.R
tests/testthat/_snaps/summary_rows_rtf.md

tests/testthat/test-summary_rows.R
tests/testthat/_snaps/summary_rows.md

Expand Down Expand Up @@ -171,6 +169,8 @@ tests/testthat/test-table_parts.R
tests/testthat/_snaps/table_parts.md

tests/testthat/test-text_transform.R
tests/testthat/_snaps/text_transform.md

tests/testthat/test-util_functions.R
tests/testthat/test-utils_formatters.R
tests/testthat/test-utils_plots.R
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

* PDF output now defaults to a full-width floating environment using `tabular*` (@AronGullickson, #1588). Float position can be controlled by the `latex.tbl.pos` argument in `tab_options`. Quarto users can alternatively use the `tbl-pos` argument to control positioning. To use a `longtable` environment instead, use `tab_option(latex.use.longtable = TRUE)`.

* Improved error messages for the `text_transform()` function if `locations` couldn't be resolved. (@olivroy, #1774)

* `tab_row_group()` gives a more precise error message when `rows` can't be resolved correctly (#1535). (@olivroy, #1770)

* Fixed an issue where `md("")` would fail in Quarto. (@olivroy, #1769)

* Fixed a bug in using `pct()` column widths with `as_gtable()` (@teunbrand, #1771)

# gt 0.11.0

## New features
Expand Down
4 changes: 0 additions & 4 deletions R/dt_cols_merge.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ dt_col_merge_set <- function(data, col_merge) {
dt__set(data, .dt_col_merge_key, col_merge)
}

dt_col_merge_init <- function(data) {
dt_col_merge_set(data = data, col_merge = list())
}

dt_col_merge_add <- function(data, col_merge) {
added <- append(dt_col_merge_get(data = data), list(col_merge))
dt_col_merge_set(data = data, col_merge = added)
Expand Down
33 changes: 24 additions & 9 deletions R/export.R
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,7 @@ grid_align_gtable <- function(gtable, data) {

} else {

right <- grid::unit(grid::unit(parse_px_to_pt(left), "pt"))
right <- grid::unit(parse_px_to_pt(left), "pt")
}

gtable <- gtable::gtable_add_cols(gtable, left, pos = 0)
Expand All @@ -1461,13 +1461,20 @@ grid_layout_widths <- function(layout, data) {

# Enlarge columns if fixed column widths have been set
column_width <- unlist(dt_boxhead_get(data)$column_width)
fixed <- integer(0L)
fixed <- integer(0)
relative <- rep(NA_real_, length(widths))

if (any(nzchar(column_width)) && length(column_width) == length(widths)) {

fixed <- which(nzchar(column_width))
widths[fixed] <- pmax(parse_px_to_pt(column_width[fixed]), widths[fixed])
fixed <- which(endsWith(column_width, "px"))
if (length(fixed) > 0) {
widths[fixed] <- pmax(parse_px_to_pt(column_width[fixed]), widths[fixed])
}
pct <- which(endsWith(column_width, "%"))
if (length(pct) > 0) {
relative[pct] <- as.numeric(gsub("\\%$", "", column_width[pct])) / 100
}
}
pct <- which(!is.na(relative))

spanner <- spanner[order(spanner$key$left, spanner$key$right), ]

Expand Down Expand Up @@ -1498,8 +1505,11 @@ grid_layout_widths <- function(layout, data) {

change <- setdiff(seq_along(widths), fixed)
widths[change] <- widths[change] + extra_width / (length(widths[change]))

return(grid::unit(widths, .grid_unit))
widths <- grid::unit(widths, .grid_unit)
if (length(pct) > 0) {
widths[pct] <- grid::unit(relative[pct], "npc")
}
return(widths)
}

if (grepl("\\%$", total_width)) {
Expand All @@ -1517,10 +1527,15 @@ grid_layout_widths <- function(layout, data) {

# Take pairwise max between minimal size and relative size
widths <- grid::unit.pmax(grid::unit(widths, .grid_unit), extra_width)
if (length(pct) > 0) {
widths[pct] <- grid::unit(relative[pct], "npc")
}
return(widths)
}

grid::unit(widths, .grid_unit)
grid::unit(
ifelse(is.na(relative), widths, relative),
ifelse(is.na(relative), .grid_unit, "npc")
)
}

#' Extract the table body from a **gt** object
Expand Down
Loading