Skip to content

Commit 4fe3e94

Browse files
authored
Merge pull request #1283 from rstudio/v0.9.0-rc
Release gt v0.9.0
2 parents eb14922 + 1b39ed1 commit 4fe3e94

20 files changed

+60
-97
lines changed

.Rbuildignore

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,20 @@ tests/performance-monitoring
2020
tests/testthat/_snaps
2121
tests/testthat/test-as_raw_html.R
2222
tests/testthat/test-as_word.R
23+
tests/testthat/test-color_handling.R
2324
tests/testthat/test-cols_align_decimal.R
2425
tests/testthat/test-cols_label.R
2526
tests/testthat/test-cols_label_with.R
2627
tests/testthat/test-cols_merge.R
2728
tests/testthat/test-cols_width_rtf.R
29+
tests/testthat/test-cols_width.R
2830
tests/testthat/test-data_color.R
31+
tests/testthat/test-escaping.R
2932
tests/testthat/test-extract_cells.R
3033
tests/testthat/test-fmt_auto.R
3134
tests/testthat/test-fmt_bytes.R
3235
tests/testthat/test-fmt_currency.R
33-
tests/testthat/test-fmt_datetime.R
36+
tests/testthat/test-fmt_date_time.R
3437
tests/testthat/test-fmt_duration.R
3538
tests/testthat/test-fmt_engineering.R
3639
tests/testthat/test-fmt_fraction.R
@@ -46,23 +49,34 @@ tests/testthat/test-fmt_scientific.R
4649
tests/testthat/test-fmt_spelled_num.R
4750
tests/testthat/test-footer.R
4851
tests/testthat/test-group_column_label.R
49-
tests/testthat/test-gt_multi.R
52+
tests/testthat/test-gt_group.R
5053
tests/testthat/test-gtsave.R
54+
tests/testthat/test-h_md_html.R
5155
tests/testthat/test-image.R
56+
tests/testthat/test-info_tables.R
57+
tests/testthat/test-input_data_validation.R
5258
tests/testthat/test-l_table_parts.R
5359
tests/testthat/test-location_cells.R
60+
tests/testthat/test-opt_functions.R
61+
tests/testthat/test-rtf_column_widths.R
5462
tests/testthat/test-rtf_page_options.R
5563
tests/testthat/test-stub.R
5664
tests/testthat/test-substitution.R
57-
tests/testthat/test-summary_rows.R
5865
tests/testthat/test-summary_rows_latex.R
5966
tests/testthat/test-summary_rows_rtf.R
67+
tests/testthat/test-summary_rows.R
6068
tests/testthat/test-tab_footnote.R
6169
tests/testthat/test-tab_info.R
6270
tests/testthat/test-tab_options.R
6371
tests/testthat/test-tab_remove.R
64-
tests/testthat/test-tab_spanner.R
6572
tests/testthat/test-tab_spanner_delim.R
73+
tests/testthat/test-tab_spanner.R
6674
tests/testthat/test-tab_stub_indent.R
75+
tests/testthat/test-tab_style.R
6776
tests/testthat/test-table_parts.R
77+
tests/testthat/test-text_transform.R
78+
tests/testthat/test-util_functions.R
79+
tests/testthat/test-utils_formatters.R
80+
tests/testthat/test-utils_render_html.R
81+
tests/testthat/test-utils.R
6882
tests/testthat/test-vec_fmt.R

DESCRIPTION

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Type: Package
22
Package: gt
3-
Version: 0.8.0.9000
3+
Version: 0.9.0
44
Title: Easily Create Presentation-Ready Display Tables
55
Description: Build display tables from tabular data with an easy-to-use set of
66
functions. With its progressive approach, we can construct display tables
@@ -40,11 +40,12 @@ Imports:
4040
commonmark (>= 1.8.1),
4141
dplyr (>= 1.1.0),
4242
fs (>= 1.6.1),
43-
ggplot2 (>= 3.4.1),
4443
glue (>= 1.6.2),
4544
htmltools (>= 0.5.4),
4645
htmlwidgets (>= 1.6.1),
46+
juicyjuice (>= 0.1.0),
4747
magrittr (>= 2.0.2),
48+
markdown (>= 1.5),
4849
reactable (>= 0.4.3),
4950
rlang (>= 1.0.2),
5051
sass (>= 0.4.5),
@@ -55,10 +56,9 @@ Imports:
5556
Suggests:
5657
covr,
5758
digest (>= 0.6.31),
58-
juicyjuice (>= 0.1.0),
59+
ggplot2,
5960
knitr,
6061
lubridate,
61-
markdown (>= 1.5),
6262
paletteer,
6363
RColorBrewer,
6464
rmarkdown (>= 2.20),

NEWS.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# gt (development version)
1+
# gt 0.9.0
22

33
## New features
44

@@ -82,8 +82,6 @@
8282

8383
* Fixed some border-related issues for **gt** tables published in R Markdown and Quarto documents (#1120). (#1234)
8484

85-
* The **juicyjuice** package is now a soft dependency. The previous hard requirement presented some problems for users in environments where the installation of the package was difficult (because of its own dependency on **V8**) (#1179). (#1229)
86-
8785
* Added the `quarto.use_bootstrap` and `quarto.disable_processing` options in `tab_options()` to control whether Quarto will add Bootstrap classes to a **gt** table or ignore a **gt** table. (#1222, #1227)
8886

8987
* Fixed the unintended appearance of a bottom border in the column spanner row for some CSS environments. (#1209)

R/export.R

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -497,16 +497,6 @@ as_raw_html <- function(
497497

498498
if (inline_css) {
499499

500-
# Check whether juicyjuice is in the package library and stop function
501-
# only if it is not present
502-
if (!requireNamespace("juicyjuice", quietly = TRUE)) {
503-
504-
cli::cli_abort(c(
505-
"Using `as_raw_html(... , inline_css = TRUE)` requires the `juicyjuice` package.",
506-
"*" = "It can be installed with `install.packages(\"juicyjuice\")`."
507-
))
508-
}
509-
510500
font_vec <- unique(dt_options_get_value(data = data, option = "table_font_names"))
511501
font_family_attr <- as_css_font_family_attr(font_vec = font_vec)
512502

R/format_data.R

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7348,10 +7348,9 @@ fmt_flag <- function(
73487348
#'
73497349
#' @inheritParams fmt_number
73507350
#' @param md_engine The engine preference for Markdown rendering. By default,
7351-
#' this is set to `"auto"` where **gt** will choose the **markdown** package
7352-
#' if it is available in the user library, otherwise functions from the
7353-
#' **commonmark** package will be used. You can explicitly choose one or the
7354-
#' other with the `"markdown"` or `"commonmark"` keyword option.
7351+
#' this is set to `"markdown"` where **gt** will use the **markdown** package
7352+
#' for Markdown conversion to HTML and LaTeX. The other option is
7353+
#' `"commonmark"` and with that the **commonmark** package will be used.
73557354
#'
73567355
#' @return An object of class `gt_tbl`.
73577356
#'
@@ -7464,7 +7463,7 @@ fmt_markdown <- function(
74647463
data,
74657464
columns = everything(),
74667465
rows = everything(),
7467-
md_engine = c("auto", "markdown", "commonmark")
7466+
md_engine = c("markdown", "commonmark")
74687467
) {
74697468

74707469
# Perform input object validation

R/format_vec.R

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3348,10 +3348,9 @@ vec_fmt_duration <- function(
33483348
#'
33493349
#' @inheritParams vec_fmt_number
33503350
#' @param md_engine The engine preference for Markdown rendering. By default,
3351-
#' this is set to `"auto"` where **gt** will choose the **markdown** package
3352-
#' if it is available in the user library, otherwise functions from the
3353-
#' **commonmark** package will be used. You can explicitly choose one or the
3354-
#' other with the `"markdown"` or `"commonmark"` keyword option.
3351+
#' this is set to `"markdown"` where **gt** will use the **markdown** package
3352+
#' for Markdown conversion to HTML and LaTeX. The other option is
3353+
#' `"commonmark"` and with that the **commonmark** package will be used.
33553354
#'
33563355
#' @return A character vector.
33573356
#'
@@ -3401,7 +3400,7 @@ vec_fmt_duration <- function(
34013400
#' @export
34023401
vec_fmt_markdown <- function(
34033402
x,
3404-
md_engine = c("auto", "markdown", "commonmark"),
3403+
md_engine = c("markdown", "commonmark"),
34053404
output = c("auto", "plain", "html", "latex", "rtf", "word")
34063405
) {
34073406

R/image.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,14 @@ ggplot_image <- function(
298298
aspect_ratio = 1.0
299299
) {
300300

301+
if (!requireNamespace("ggplot2", quietly = TRUE)) {
302+
303+
cli::cli_abort(c(
304+
"Using the `ggplot_image()` function requires the `ggplot2` package.",
305+
"*" = "It can be installed with `install.packages(\"ggplot2\")`."
306+
))
307+
}
308+
301309
if (is.numeric(height)) {
302310
height <- paste0(height, "px")
303311
}

R/utils.R

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -405,18 +405,9 @@ get_markdown_engine_fn <- function(
405405

406406
context <- match.arg(context)
407407

408-
md_engine_name <-
409-
switch(
410-
md_engine_pref,
411-
auto = ,
412-
markdown = "markdown",
413-
commonmark = "commonmark"
414-
)
415-
416408
md_engine_fn <-
417409
switch(
418410
md_engine_pref,
419-
auto = ,
420411
markdown = markdown::mark,
421412
commonmark = if (context == "html") {
422413
commonmark::markdown_html
@@ -425,39 +416,8 @@ get_markdown_engine_fn <- function(
425416
}
426417
)
427418

428-
# Stop function if user explicitly chose the `markdown` package as
429-
# the Markdown engine but the package is not available
430-
if (md_engine_pref == "markdown") {
431-
432-
if (!requireNamespace("markdown", quietly = TRUE)) {
433-
434-
cli::cli_abort(c(
435-
"Using the \"markdown\"` engine preference requires the `markdown` package.",
436-
"*" = "It can be installed with `install.packages(\"markdown\")`."
437-
))
438-
}
439-
}
440-
441-
# If the Markdown engine preference was set to 'auto' (the default) and
442-
# the `markdown` is not available, use the `commonmark` package as a
443-
# fallback; the situation is that `commonmark` is a hard dependency whereas
444-
# `markdown` is a soft dependency (though commonly present in user libraries)
445-
if (
446-
md_engine_pref == "auto" &&
447-
!requireNamespace("markdown", quietly = TRUE)
448-
) {
449-
450-
if (context == "html") {
451-
md_engine_fn <- commonmark::markdown_html
452-
} else {
453-
md_engine_fn <- commonmark::markdown_latex
454-
}
455-
456-
md_engine_name <- "commonmark"
457-
}
458-
459419
md_engine_fn <- c(md_engine_fn)
460-
names(md_engine_fn) <- md_engine_name
420+
names(md_engine_fn) <- md_engine_pref
461421
md_engine_fn
462422
}
463423

@@ -474,10 +434,7 @@ process_text <- function(text, context = "html") {
474434
# When processing text globally (outside of the `fmt_markdown()`
475435
# function) we will use the 'markdown' package if it is available,
476436
# otherwise the 'commonmark' package
477-
if (
478-
requireNamespace("markdown", quietly = TRUE) &&
479-
utils::packageVersion("markdown") >= "1.5"
480-
) {
437+
if (utils::packageVersion("markdown") >= "1.5") {
481438
md_engine <- "markdown"
482439
} else {
483440
md_engine <- "commonmark"
@@ -2175,7 +2132,7 @@ data_get_image_tag <- function(file, dir = "images") {
21752132
image_url <- file.path(repo_url, dir, file)
21762133

21772134
paste0(
2178-
"<div align=\"center\">",
2135+
"<div style=\"text-align:center;\">",
21792136
"<img ",
21802137
"src=\"", image_url, "\" ",
21812138
"alt=\"", alt_text, "\" ",

man/countrypops.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/exibble.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)