Skip to content

Commit

Permalink
finally add these dang figures to building html;
Browse files Browse the repository at this point in the history
  • Loading branch information
zkamvar committed Dec 11, 2023
1 parent 82eb2c1 commit c4a9a2c
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-quarto.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
any::withr
any::sessioninfo
any::flow
any::webshot2
- name: Deploy 🚀
uses: quarto-dev/quarto-actions/publish@v2
Expand Down
35 changes: 30 additions & 5 deletions sandpaper/building-html.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@ files:

## Rendering HTML

The diagram for rendering html

```{r}
#| label: render-html
#| echo: false
#| eval: !expr Sys.getenv("CI", "false") != "true"
#| message: false
#| cache: true
toc <- Sys.time()
flow::flow_view_deps(sandpaper:::render_html, out = "render-html.png")
tmp <- "tmp.html"
flow::flow_view_uses(sandpaper:::render_html, out = tmp)
res <- webshot2::webshot(tmp, "render-html.png", zoom = 2)
unlink(tmp)
tic <- Sys.time()
cat(paste("time elapsed:", format(tic - toc)))
```
Expand All @@ -34,43 +40,62 @@ cat(paste("time elapsed:", format(tic - toc)))

## Post-processing with XML

All `fix_nodes()` calls occur before `build_html()`

```{r}
#| label: fix-nodes-uses
#| echo: false
#| eval: !expr Sys.getenv("CI", "false") != "true"
#| message: false
#| cache: true
toc <- Sys.time()
flow::flow_view_uses(sandpaper:::fix_nodes, out = "fix-nodes-uses.png")
tmp <- "tmp.html"
flow::flow_view_uses(sandpaper:::fix_nodes, out = tmp)
res <- webshot2::webshot(tmp, "fix-nodes-uses.png", zoom = 2)
unlink(tmp)
tic <- Sys.time()
cat(paste("time elapsed:", format(tic - toc)))
```

![](fix-nodes-uses.png)

`fix_nodes()` will call XML manipulating functions.


```{r}
#| label: fix-nodes-deps
#| echo: false
#| eval: !expr Sys.getenv("CI", "false") != "true"
#| message: false
#| cache: true
toc <- Sys.time()
flow::flow_view_deps(sandpaper:::fix_nodes, out = "fix-nodes-deps.png")
tmp <- "tmp.html"
flow::flow_view_deps(sandpaper:::fix_nodes, out = tmp, show_imports = "none")
res <- webshot2::webshot(tmp, "fix-nodes-deps.png", zoom = 2)
tic <- Sys.time()
unlink(tmp)
cat(paste("time elapsed:", format(tic - toc)))
```

![](fix-nodes-deps.png)

## Applying {varnish} templating

All HTML files get funneled into `pkgdown::render_page()` through `build_html()`


```{r}
#| label: render-page
#| echo: false
#| eval: !expr Sys.getenv("CI", "false") != "true"
#| cache: true
toc <- Sys.time()
flow::flow_view_uses(pkgdown::render_page, "sandpaper", out = "build-html.png")
tmp <- "tmp.html"
flow::flow_view_uses(pkgdown::render_page, "sandpaper", out = tmp)
res <- webshot2::webshot(tmp, "render-page.png", zoom = 2)
unlink(tmp)
tic <- Sys.time()
cat(paste("time elapsed:", format(tic - toc)))
```

![](build-html.png)
![](render-page.png)
Binary file added sandpaper/fix-nodes-deps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sandpaper/fix-nodes-uses.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sandpaper/render-html.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sandpaper/render-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c4a9a2c

Please sign in to comment.