Skip to content

Commit

Permalink
Force arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Mar 17, 2021
1 parent a8c7452 commit 6e50dd5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion R/html_dependency.R
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ makeDependencyRelative <- function(dependency, basepath, mustWork = TRUE) {
#'
#' @param dependencies A list of \code{htmlDependency} objects.
#' @param srcType The type of src paths to use; valid values are \code{file} or
#' \code{href}.
#' \code{href}. If both types are available to a dependency, and both types
#' are supplied to this argument, then the 1st type is preferred.
#' @param encodeFunc The function to use to encode the path part of a URL. The
#' default should generally be used.
#' @param hrefFilter A function used to transform the final, encoded URLs of
Expand Down
2 changes: 2 additions & 0 deletions R/html_print.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ save_html <- function(html, file, background = "white", libdir = "lib", lang = "

rendered <- renderTags(html)

browser()
deps <- lapply(rendered$dependencies, function(dep) {
dep <- copyDependencyToDir(dep, libdir, FALSE)
dep <- makeDependencyRelative(dep, dir, FALSE)
Expand All @@ -99,6 +100,7 @@ save_html <- function(html, file, background = "white", libdir = "lib", lang = "
"</body>"
}

browser()
# build the web-page
html <- c("<!DOCTYPE html>",
sprintf('<html lang="%s">', lang),
Expand Down
10 changes: 10 additions & 0 deletions R/tags.R
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ tagAppendAttributes.shiny.tag <- function(tag, ...) {

#' @export
tagAppendAttributes.shiny.tag.function <- function(tag, ...) {
force(tag)
force(...)
tagFunction(function() {
tag <- doTagFunction(tag)
tagAppendAttributes(tag, ...)
Expand Down Expand Up @@ -350,6 +352,8 @@ tagAppendChild.shiny.tag <- function(tag, child) {

#' @export
tagAppendChild.shiny.tag.function <- function(tag, child) {
force(tag)
force(child)
tagFunction(function() {
tag <- doTagFunction(tag)
tagAppendChild(tag, child)
Expand All @@ -371,6 +375,9 @@ tagAppendChildren.shiny.tag <- function(tag, ..., list = NULL) {

#' @export
tagAppendChildren.shiny.tag.function <- function(tag, ..., list = NULL) {
force(tag)
force(...)
force(list)
tagFunction(function() {
tag <- doTagFunction(tag)
tagAppendChildren(tag, ..., list)
Expand All @@ -391,6 +398,9 @@ tagSetChildren.shiny.tag <- function(tag, ..., list = NULL) {

#' @export
tagSetChildren.shiny.tag.function <- function(tag, ..., list = NULL) {
force(tag)
force(...)
force(list)
tagFunction(function() {
tag <- doTagFunction(tag)
tagSetChildren(tag, ..., list)
Expand Down
2 changes: 1 addition & 1 deletion R/template.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ htmlTemplate <- function(filename = NULL, ..., text_ = NULL, document_ = "auto")
#'
#' This function renders \code{html_document} objects, and returns a string with
#' the final HTML content. It calls the \code{\link{renderTags}} function to
#' convert any shiny.tag objects to HTML. It also finds any any web dependencies
#' convert any shiny.tag objects to HTML. It also finds any web dependencies
#' (created by \code{\link{htmlDependency}}) that are attached to the tags, and
#' inserts those. To do the insertion, this function finds the string
#' \code{"<!-- HEAD_CONTENT -->"} in the document, and replaces it with the web
Expand Down

0 comments on commit 6e50dd5

Please sign in to comment.