Skip to content

Commit ca7f6a7

Browse files
Fix - not all images were encoded as dataURIs
1 parent a416d15 commit ca7f6a7

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

R/handler_void.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#' }}
1313
#'
1414
#' @details
15-
#' This progression handler give not output - it is invisible and silent.
15+
#' This progression handler gives not output - it is invisible and silent.
1616
#'
1717
#' @export
1818
handler_void <- function(intrusiveness = 0, ...) {

R/vignette_engine.R

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,18 @@ register_vignette_engine_during_build_only <- function(pkgname) {
2222
smart = FALSE,
2323
extensions = "table",
2424
normalize = FALSE)
25-
26-
## Embed images as <img src="data:img/png;base64...">
25+
26+
## Embed images as <img src="data:image/png;base64...">
2727
mimes <- list(
2828
gif = "image/gif",
2929
jpg = "image/jpeg",
3030
png = "image/png",
3131
svg = "image/svg+xml"
3232
)
33-
for (kk in seq_along(mimes)) {
34-
mime <- mimes[[kk]]
35-
pattern <- sprintf('(.*[ ]src=")([^"]+[.]%s)(".*)', names(mimes)[kk])
33+
html <- unlist(strsplit(html, split = "\n", fixed = TRUE))
34+
for (ext in names(mimes)) {
35+
mime <- mimes[[ext]]
36+
pattern <- sprintf('(.*[ ]src=")([^"]+[.]%s)(".*)', ext)
3637
idxs <- grep(pattern, html)
3738
if (length(idxs) == 0) next
3839
for (idx in idxs) {
@@ -41,7 +42,7 @@ register_vignette_engine_during_build_only <- function(pkgname) {
4142
html[idx] <- gsub(pattern, sprintf("\\1%s\\3", uri), html[idx])
4243
}
4344
}
44-
45+
4546
## Inject HTML environment
4647
html <- c("<!DOCTYPE html>",
4748
"<html lang=\"en\">",

man/handler_void.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)