Skip to content

Commit a416d15

Browse files
Fix vignette; image links were broken - now embedded as base64 dataURI
1 parent 43656aa commit a416d15

19 files changed

+30
-18
lines changed

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Suggests:
2424
furrr,
2525
shiny,
2626
commonmark,
27+
base64enc,
2728
tools
2829
VignetteBuilder: progressr
2930
URL: https://github.com/HenrikBengtsson/progressr

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ include .make/Makefile
22

33
vignettes/progressr-intro.md: OVERVIEW.md vignettes/incl/clean.css
44
sed -i '/%\\Vignette/!d' $@
5-
sed -i 's/inst\/doc\///g' $@
65
echo "<!-- DO NOT EDIT THIS FILE! Edit 'OVERVIEW.md' instead and then rebuild this file with 'make vigs' -->" >> $@
76
cat $< >> $@
7+
sed -i 's/vignettes\///g' $@
88

99
vigs: vignettes/progressr-intro.md

OVERVIEW.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
![Life cycle: experimental](inst/doc/imgs/lifecycle-experimental-orange.svg)
1+
![Life cycle: experimental](vignettes/imgs/lifecycle-experimental-orange.svg)
22

33
The **[progressr]** package provides a minimal API for reporting progress updates in [R](https://www.r-project.org/). The design is to separate the representation of progress updates from how they are presented. What type of progress to signal is controlled by the developer. How these progress updates are rendered is controlled by the end user. For instance, some users may prefer visual feedback such as a horizontal progress bar in the terminal, whereas others may prefer auditory feedback.
44

55

6-
<img src="inst/doc/imgs/three_in_chinese.gif" alt="Three strokes writing three in Chinese" style="float: right; margin-right: 1ex; margin-left: 1ex;"/>
6+
<img src="vignettes/imgs/three_in_chinese.gif" alt="Three strokes writing three in Chinese" style="float: right; margin-right: 1ex; margin-left: 1ex;"/>
77

88
Design motto:
99

@@ -301,7 +301,7 @@ When using the **progressr** package, progression updates are communicated via R
301301

302302

303303

304-
![](inst/doc/imgs/slow_sum.svg)
304+
![](vignettes/imgs/slow_sum.svg)
305305

306306
_Figure: Sequence diagram illustrating how signaled progression conditions are captured by `with_progress()` and relayed to the two progression handlers 'progress' (a progress bar in the terminal) and 'beepr' (auditory) that the end user has chosen._
307307

R/vignette_engine.R

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@ register_vignette_engine_during_build_only <- function(pkgname) {
2323
extensions = "table",
2424
normalize = FALSE)
2525

26+
## Embed images as <img src="data:img/png;base64...">
27+
mimes <- list(
28+
gif = "image/gif",
29+
jpg = "image/jpeg",
30+
png = "image/png",
31+
svg = "image/svg+xml"
32+
)
33+
for (kk in seq_along(mimes)) {
34+
mime <- mimes[[kk]]
35+
pattern <- sprintf('(.*[ ]src=")([^"]+[.]%s)(".*)', names(mimes)[kk])
36+
idxs <- grep(pattern, html)
37+
if (length(idxs) == 0) next
38+
for (idx in idxs) {
39+
file <- gsub(pattern, "\\2", html[idx])
40+
uri <- base64enc::dataURI(file = file, mime = mime)
41+
html[idx] <- gsub(pattern, sprintf("\\1%s\\3", uri), html[idx])
42+
}
43+
}
44+
2645
## Inject HTML environment
2746
html <- c("<!DOCTYPE html>",
2847
"<html lang=\"en\">",
@@ -49,4 +68,3 @@ register_vignette_engine_during_build_only <- function(pkgname) {
4968
}
5069
)
5170
}
52-

README.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# progressr: A Inclusive, Unifying API for Progress Updates
22

3-
![Life cycle: experimental](inst/doc/imgs/lifecycle-experimental-orange.svg)
3+
![Life cycle: experimental](vignettes/imgs/lifecycle-experimental-orange.svg)
44

55
The **[progressr]** package provides a minimal API for reporting progress updates in [R](https://www.r-project.org/). The design is to separate the representation of progress updates from how they are presented. What type of progress to signal is controlled by the developer. How these progress updates are rendered is controlled by the end user. For instance, some users may prefer visual feedback such as a horizontal progress bar in the terminal, whereas others may prefer auditory feedback.
66

77

8-
<img src="inst/doc/imgs/three_in_chinese.gif" alt="Three strokes writing three in Chinese" style="float: right; margin-right: 1ex; margin-left: 1ex;"/>
8+
<img src="vignettes/imgs/three_in_chinese.gif" alt="Three strokes writing three in Chinese" style="float: right; margin-right: 1ex; margin-left: 1ex;"/>
99

1010
Design motto:
1111

@@ -303,7 +303,7 @@ When using the **progressr** package, progression updates are communicated via R
303303

304304

305305

306-
![](inst/doc/imgs/slow_sum.svg)
306+
![](vignettes/imgs/slow_sum.svg)
307307

308308
_Figure: Sequence diagram illustrating how signaled progression conditions are captured by `with_progress()` and relayed to the two progression handlers 'progress' (a progress bar in the terminal) and 'beepr' (auditory) that the end user has chosen._
309309

@@ -349,13 +349,6 @@ R package progressr is available on [CRAN](https://cran.r-project.org/package=pr
349349
install.packages("progressr")
350350
```
351351

352-
### Pre-release version
353-
354-
To install the pre-release version that is available in Git branch `develop` on GitHub, use:
355-
```r
356-
remotes::install_github("HenrikBengtsson/progressr@develop")
357-
```
358-
This will install the package from source.
359352

360353

361354

File renamed without changes.

0 commit comments

Comments
 (0)