Skip to content

Commit

Permalink
Merge pull request #1283 from rstudio/v0.9.0-rc
Browse files Browse the repository at this point in the history
Release gt v0.9.0
  • Loading branch information
rich-iannone authored Mar 31, 2023
2 parents eb14922 + 1b39ed1 commit 4fe3e94
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 97 deletions.
22 changes: 18 additions & 4 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,20 @@ tests/performance-monitoring
tests/testthat/_snaps
tests/testthat/test-as_raw_html.R
tests/testthat/test-as_word.R
tests/testthat/test-color_handling.R
tests/testthat/test-cols_align_decimal.R
tests/testthat/test-cols_label.R
tests/testthat/test-cols_label_with.R
tests/testthat/test-cols_merge.R
tests/testthat/test-cols_width_rtf.R
tests/testthat/test-cols_width.R
tests/testthat/test-data_color.R
tests/testthat/test-escaping.R
tests/testthat/test-extract_cells.R
tests/testthat/test-fmt_auto.R
tests/testthat/test-fmt_bytes.R
tests/testthat/test-fmt_currency.R
tests/testthat/test-fmt_datetime.R
tests/testthat/test-fmt_date_time.R
tests/testthat/test-fmt_duration.R
tests/testthat/test-fmt_engineering.R
tests/testthat/test-fmt_fraction.R
Expand All @@ -46,23 +49,34 @@ tests/testthat/test-fmt_scientific.R
tests/testthat/test-fmt_spelled_num.R
tests/testthat/test-footer.R
tests/testthat/test-group_column_label.R
tests/testthat/test-gt_multi.R
tests/testthat/test-gt_group.R
tests/testthat/test-gtsave.R
tests/testthat/test-h_md_html.R
tests/testthat/test-image.R
tests/testthat/test-info_tables.R
tests/testthat/test-input_data_validation.R
tests/testthat/test-l_table_parts.R
tests/testthat/test-location_cells.R
tests/testthat/test-opt_functions.R
tests/testthat/test-rtf_column_widths.R
tests/testthat/test-rtf_page_options.R
tests/testthat/test-stub.R
tests/testthat/test-substitution.R
tests/testthat/test-summary_rows.R
tests/testthat/test-summary_rows_latex.R
tests/testthat/test-summary_rows_rtf.R
tests/testthat/test-summary_rows.R
tests/testthat/test-tab_footnote.R
tests/testthat/test-tab_info.R
tests/testthat/test-tab_options.R
tests/testthat/test-tab_remove.R
tests/testthat/test-tab_spanner.R
tests/testthat/test-tab_spanner_delim.R
tests/testthat/test-tab_spanner.R
tests/testthat/test-tab_stub_indent.R
tests/testthat/test-tab_style.R
tests/testthat/test-table_parts.R
tests/testthat/test-text_transform.R
tests/testthat/test-util_functions.R
tests/testthat/test-utils_formatters.R
tests/testthat/test-utils_render_html.R
tests/testthat/test-utils.R
tests/testthat/test-vec_fmt.R
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Type: Package
Package: gt
Version: 0.8.0.9000
Version: 0.9.0
Title: Easily Create Presentation-Ready Display Tables
Description: Build display tables from tabular data with an easy-to-use set of
functions. With its progressive approach, we can construct display tables
Expand Down Expand Up @@ -40,11 +40,12 @@ Imports:
commonmark (>= 1.8.1),
dplyr (>= 1.1.0),
fs (>= 1.6.1),
ggplot2 (>= 3.4.1),
glue (>= 1.6.2),
htmltools (>= 0.5.4),
htmlwidgets (>= 1.6.1),
juicyjuice (>= 0.1.0),
magrittr (>= 2.0.2),
markdown (>= 1.5),
reactable (>= 0.4.3),
rlang (>= 1.0.2),
sass (>= 0.4.5),
Expand All @@ -55,10 +56,9 @@ Imports:
Suggests:
covr,
digest (>= 0.6.31),
juicyjuice (>= 0.1.0),
ggplot2,
knitr,
lubridate,
markdown (>= 1.5),
paletteer,
RColorBrewer,
rmarkdown (>= 2.20),
Expand Down
4 changes: 1 addition & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# gt (development version)
# gt 0.9.0

## New features

Expand Down Expand Up @@ -82,8 +82,6 @@

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

* 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)

* 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)

* Fixed the unintended appearance of a bottom border in the column spanner row for some CSS environments. (#1209)
Expand Down
10 changes: 0 additions & 10 deletions R/export.R
Original file line number Diff line number Diff line change
Expand Up @@ -497,16 +497,6 @@ as_raw_html <- function(

if (inline_css) {

# Check whether juicyjuice is in the package library and stop function
# only if it is not present
if (!requireNamespace("juicyjuice", quietly = TRUE)) {

cli::cli_abort(c(
"Using `as_raw_html(... , inline_css = TRUE)` requires the `juicyjuice` package.",
"*" = "It can be installed with `install.packages(\"juicyjuice\")`."
))
}

font_vec <- unique(dt_options_get_value(data = data, option = "table_font_names"))
font_family_attr <- as_css_font_family_attr(font_vec = font_vec)

Expand Down
9 changes: 4 additions & 5 deletions R/format_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -7348,10 +7348,9 @@ fmt_flag <- function(
#'
#' @inheritParams fmt_number
#' @param md_engine The engine preference for Markdown rendering. By default,
#' this is set to `"auto"` where **gt** will choose the **markdown** package
#' if it is available in the user library, otherwise functions from the
#' **commonmark** package will be used. You can explicitly choose one or the
#' other with the `"markdown"` or `"commonmark"` keyword option.
#' this is set to `"markdown"` where **gt** will use the **markdown** package
#' for Markdown conversion to HTML and LaTeX. The other option is
#' `"commonmark"` and with that the **commonmark** package will be used.
#'
#' @return An object of class `gt_tbl`.
#'
Expand Down Expand Up @@ -7464,7 +7463,7 @@ fmt_markdown <- function(
data,
columns = everything(),
rows = everything(),
md_engine = c("auto", "markdown", "commonmark")
md_engine = c("markdown", "commonmark")
) {

# Perform input object validation
Expand Down
9 changes: 4 additions & 5 deletions R/format_vec.R
Original file line number Diff line number Diff line change
Expand Up @@ -3348,10 +3348,9 @@ vec_fmt_duration <- function(
#'
#' @inheritParams vec_fmt_number
#' @param md_engine The engine preference for Markdown rendering. By default,
#' this is set to `"auto"` where **gt** will choose the **markdown** package
#' if it is available in the user library, otherwise functions from the
#' **commonmark** package will be used. You can explicitly choose one or the
#' other with the `"markdown"` or `"commonmark"` keyword option.
#' this is set to `"markdown"` where **gt** will use the **markdown** package
#' for Markdown conversion to HTML and LaTeX. The other option is
#' `"commonmark"` and with that the **commonmark** package will be used.
#'
#' @return A character vector.
#'
Expand Down Expand Up @@ -3401,7 +3400,7 @@ vec_fmt_duration <- function(
#' @export
vec_fmt_markdown <- function(
x,
md_engine = c("auto", "markdown", "commonmark"),
md_engine = c("markdown", "commonmark"),
output = c("auto", "plain", "html", "latex", "rtf", "word")
) {

Expand Down
8 changes: 8 additions & 0 deletions R/image.R
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,14 @@ ggplot_image <- function(
aspect_ratio = 1.0
) {

if (!requireNamespace("ggplot2", quietly = TRUE)) {

cli::cli_abort(c(
"Using the `ggplot_image()` function requires the `ggplot2` package.",
"*" = "It can be installed with `install.packages(\"ggplot2\")`."
))
}

if (is.numeric(height)) {
height <- paste0(height, "px")
}
Expand Down
49 changes: 3 additions & 46 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -405,18 +405,9 @@ get_markdown_engine_fn <- function(

context <- match.arg(context)

md_engine_name <-
switch(
md_engine_pref,
auto = ,
markdown = "markdown",
commonmark = "commonmark"
)

md_engine_fn <-
switch(
md_engine_pref,
auto = ,
markdown = markdown::mark,
commonmark = if (context == "html") {
commonmark::markdown_html
Expand All @@ -425,39 +416,8 @@ get_markdown_engine_fn <- function(
}
)

# Stop function if user explicitly chose the `markdown` package as
# the Markdown engine but the package is not available
if (md_engine_pref == "markdown") {

if (!requireNamespace("markdown", quietly = TRUE)) {

cli::cli_abort(c(
"Using the \"markdown\"` engine preference requires the `markdown` package.",
"*" = "It can be installed with `install.packages(\"markdown\")`."
))
}
}

# If the Markdown engine preference was set to 'auto' (the default) and
# the `markdown` is not available, use the `commonmark` package as a
# fallback; the situation is that `commonmark` is a hard dependency whereas
# `markdown` is a soft dependency (though commonly present in user libraries)
if (
md_engine_pref == "auto" &&
!requireNamespace("markdown", quietly = TRUE)
) {

if (context == "html") {
md_engine_fn <- commonmark::markdown_html
} else {
md_engine_fn <- commonmark::markdown_latex
}

md_engine_name <- "commonmark"
}

md_engine_fn <- c(md_engine_fn)
names(md_engine_fn) <- md_engine_name
names(md_engine_fn) <- md_engine_pref
md_engine_fn
}

Expand All @@ -474,10 +434,7 @@ process_text <- function(text, context = "html") {
# When processing text globally (outside of the `fmt_markdown()`
# function) we will use the 'markdown' package if it is available,
# otherwise the 'commonmark' package
if (
requireNamespace("markdown", quietly = TRUE) &&
utils::packageVersion("markdown") >= "1.5"
) {
if (utils::packageVersion("markdown") >= "1.5") {
md_engine <- "markdown"
} else {
md_engine <- "commonmark"
Expand Down Expand Up @@ -2175,7 +2132,7 @@ data_get_image_tag <- function(file, dir = "images") {
image_url <- file.path(repo_url, dir, file)

paste0(
"<div align=\"center\">",
"<div style=\"text-align:center;\">",
"<img ",
"src=\"", image_url, "\" ",
"alt=\"", alt_text, "\" ",
Expand Down
2 changes: 1 addition & 1 deletion man/countrypops.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/exibble.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions man/fmt_markdown.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/gtcars.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/metro.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/pizzaplace.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/rx_addv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/rx_adsl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/sp500.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/sza.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/towny.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4fe3e94

Please sign in to comment.