Skip to content

Commit

Permalink
if both @foo and foo are present in css/js, remove foo and use …
Browse files Browse the repository at this point in the history
…`@foo` only
  • Loading branch information
yihui committed Dec 1, 2023
1 parent bbffc80 commit 822c7e7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,17 @@ jsdelivr = function(file, dir = 'gh/rstudio/markdown/inst/resources/') {
ifelse(is_https(file), file, sprintf('https://cdn.jsdelivr.net/%s%s', dir, file))
}

# if both @foo and foo are present, remove foo
resolve_dups = function(x) {
for (i in grep('^@', x, value = TRUE)) {
x = x[x != sub('^@', '', i)]
}
x
}

# resolve CSS/JS shorthand filenames to actual paths (e.g., 'default' to 'default.css')
resolve_files = function(x, ext = 'css') {
x = resolve_dups(x)
if (length(x) == 0) return(x)
# @foo -> jsdelivr.net/gh/rstudio/markdown
i0 = grepl('^@', x)
Expand Down

0 comments on commit 822c7e7

Please sign in to comment.