Skip to content

Commit

Permalink
Fixing Null error with glue::glue interpolation (#233)
Browse files Browse the repository at this point in the history
* Fixing NULL error with glue interpolation

* Update utils.R

* Update utils.R
  • Loading branch information
HammadTheOne authored Oct 21, 2020
1 parent 3b54773 commit 03ed383
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,10 @@ generate_css_dist_html <- function(tagdata,
perl=TRUE)) || as_is) {
if (is.list(tagdata))
glue::glue('<link ', glue::glue_collapse(glue::glue('{attribs}="{tagdata}"'), sep=" "), ' rel="stylesheet">')
else
glue::glue('<link ', glue::glue('href="{tagdata}"'), ' rel="stylesheet">')
else {
interpolated_link <- glue::glue('href="{tagdata}"')
glue::glue('<link ', '{interpolated_link}', ' rel="stylesheet">')
}
}
else
stop(sprintf("Invalid URL supplied in external_stylesheets. Please check the syntax used for this parameter."), call. = FALSE)
Expand All @@ -599,7 +601,8 @@ generate_css_dist_html <- function(tagdata,
}
else {
tagdata <- sub("^/", "", tagdata)
glue::glue('<link ', glue::glue('href="{prefix}{tagdata}?m={modified}"'), ' rel="stylesheet">')
interpolated_link <- glue::glue('href="{prefix}{tagdata}?m={modified}"')
glue::glue('<link ', '{interpolated_link}', ' rel="stylesheet">')
}
}
}
Expand All @@ -617,8 +620,10 @@ generate_js_dist_html <- function(tagdata,
perl=TRUE)) || as_is) {
if (is.list(tagdata))
glue::glue('<script ', glue::glue_collapse(glue::glue('{attribs}="{tagdata}"'), sep=" "), '></script>')
else
glue::glue('<script ', glue::glue('src="{tagdata}"'), '></script>')
else {
interpolated_link <- glue::glue('src="{tagdata}"')
glue::glue('<script ', '{interpolated_link}', '></script>')
}
}
else
stop(sprintf("Invalid URL supplied. Please check the syntax used for this parameter."), call. = FALSE)
Expand All @@ -631,7 +636,8 @@ generate_js_dist_html <- function(tagdata,
}
else {
tagdata <- sub("^/", "", tagdata)
glue::glue('<script ', glue::glue('src="{prefix}{tagdata}?m={modified}"'), '></script>')
interpolated_link <- glue::glue('src="{prefix}{tagdata}?m={modified}"')
glue::glue('<script ', '{interpolated_link}', '></script>')
}
}
}
Expand Down

0 comments on commit 03ed383

Please sign in to comment.