-
Notifications
You must be signed in to change notification settings - Fork 70
Closed
Description
The script component of htmlDependency can be a list containing list entries in order to set attributes on the included script. However, if all_files = FALSE is used, this fails. For example, the markdown file below fails to render. Changing all_files to TRUE makes it work, as does changing self_contained to true.
The problem appears to be here:
Line 358 in e472321
| unlist(dependency[c('script', 'stylesheet', 'attachment')]) |
because the code assumes dependencies are all simple filenames.
Here's the sample file to demonstrate:
---
title: "Untitled"
output:
html_document:
self_contained: false
---
```{r}
javascript <- 'console.log("this is Javascript to write to the console");'
f1 <- tempfile(fileext = ".js")
writeLines(javascript, f1)
text <- 'this is some text to go in a script'
f2 <- tempfile(fileext = ".txt")
writeLines(text, f2)
```
```{r}
library(htmltools)
deps <- htmlDependency("test", "1.0",
src = tempdir(),
script = list(basename(f1),
list(src = basename(f2),
type = "text/plain",
id = "shader")),
all_files = FALSE
)
tag <- tags$p("this is visible text", deps)
tag
```
Metadata
Metadata
Assignees
Labels
No labels