Skip to content

Commit 784f9a9

Browse files
HTML print() is always portable
1 parent 748b13c commit 784f9a9

File tree

4 files changed

+8
-19
lines changed

4 files changed

+8
-19
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Package: tinytable
22
Type: Package
33
Title: Simple and Configurable Tables in 'HTML', 'LaTeX', 'Markdown', 'Word', 'PNG', 'PDF', and 'Typst' Formats
44
Description: Create highly customized tables with this simple and dependency-free package. Data frames can be converted to 'HTML', 'LaTeX', 'Markdown', 'Word', 'PNG', 'PDF', or 'Typst' tables. The user interface is minimalist and easy to learn. The syntax is concise. 'HTML' tables can be customized using the flexible 'Bootstrap' framework, and 'LaTeX' code with the 'tabularray' package.
5-
Version: 0.15.0.1
5+
Version: 0.15.0.2
66
Imports:
77
methods
88
Depends:

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## 0.15.0.1
44

5+
Misc:
6+
7+
* `print(tab, "html")` always base 64 encodes images. This is useful because it makes files more portable when viewed in IDEs, and because it simplifies path handling in temporary directories across operating systems.
8+
59
Bugs:
610

711
* Fixed spurious Windows portable HTML warning when using `height` parameter with non-HTML output formats (Issue #608).

R/print.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@ print.tinytable <- function(
9292
dir <- getOption("tinytable_tempdir", default = tempdir())
9393
dir <- sub("\\/$", "", dir)
9494

95-
if (output == "html") {
95+
if (identical(output, "html")) {
9696
x@output_dir <- dir
97+
x@html_portable <- TRUE
9798
}
9899

100+
99101
x <- build_tt(x, output = output)
100102

101103
tab <- x@table_string

R/theme_html.R

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,6 @@ theme_html <- function(
6767
sanity_tabulator_css_rule(tabulator_css_rule)
6868
sanity_tabulator_columns(tabulator_columns)
6969

70-
# Defer portable warning check until finalization when output format is known
71-
if (isTRUE(Sys.info()["sysname"] == "Windows")) {
72-
fn_portable_warning <- function(table) {
73-
if (!isTRUE(table@html_portable)) {
74-
warning("On Windows, `tinytable` should embed images in the HTML file directly. Set `theme_html(portable=TRUE)` explicitly to silence this warning.",
75-
call. = FALSE
76-
)
77-
}
78-
return(table)
79-
}
80-
x <- build_finalize(x, fn_portable_warning, output = "html")
81-
}
82-
83-
8470
if (!is.null(engine)) {
8571
x@html_engine <- engine
8672
if (engine == "bootstrap" && is.null(class) && identical(x@html_class, "tinytable")) {
@@ -104,9 +90,6 @@ theme_html <- function(
10490

10591
if (!is.null(portable)) {
10692
assert_flag(portable)
107-
if (isTRUE(portable)) {
108-
assert_dependency("base64enc")
109-
}
11093
x@html_portable <- portable
11194
}
11295

0 commit comments

Comments
 (0)