Skip to content

Commit

Permalink
Merged upstream/main into olivroy-rethrow-alt
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed May 21, 2024
2 parents 1ef569d + 39ea964 commit d5b2991
Show file tree
Hide file tree
Showing 57 changed files with 412 additions and 385 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# pkgdown (development version)

* Custom navbars that specify `icon` but not `aria-label` will now generate a message reminding you to provide one for to improve accessibility (#2533).
* `init_site()` will no longer automatically build favicons on CI systems (e.g. GHA). This is an expensive operation that uses an external service so it should only be run locally (#2553).
* `build_home_index()` now reports when rendering the home page (#2544).
* Bootstrap 3 has been deprecated. It was superseded in December 2021, and now we're starting to more directly encourage folks to move away from it.
* Improve HTML5 compliance (#2369):
* No longer support IE9 or earlier
Expand Down
12 changes: 5 additions & 7 deletions R/build-articles.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@
#'
#' ## Missing topics
#'
#' pkgdown will warn if there are (non-internal) articles that aren't listed
#' in the articles index. You can suppress such warnings by listing the
#' affected articles in a section with `title: internal` (case sensitive);
#' pkgdown will warn if there are (non-internal) articles that aren't listed
#' in the articles index. You can suppress such warnings by listing the
#' affected articles in a section with `title: internal` (case sensitive);
#' this section will not be displayed on the index page.
#'
#' # External files
Expand Down Expand Up @@ -248,10 +248,8 @@ build_article <- function(name,

front <- rmarkdown::yaml_front_matter(input_path)
# Take opengraph from article's yaml front matter
front_opengraph <- check_open_graph(front$opengraph %||% list())
data$opengraph <- utils::modifyList(
data$opengraph %||% list(), front_opengraph
)
front_opengraph <- check_open_graph(front$opengraph, input)
data$opengraph <- modify_list(data$opengraph, front_opengraph)

# Allow users to opt-in to their own template
ext <- purrr::pluck(front, "pkgdown", "extension", .default = "html")
Expand Down
4 changes: 2 additions & 2 deletions R/build-favicons.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ build_favicons <- function(pkg = ".", overwrite = FALSE) {
cli::cli_abort("API request failed.", .internal = TRUE)
}

tmp <- withr::local_tempdir()
tmp <- withr::local_tempfile()
result <- httr::RETRY(
"GET",
result$favicon$package_url,
httr::write_disk(tmp),
httr::write_disk(tmp, overwrite = TRUE),
quiet = TRUE
)

Expand Down
4 changes: 2 additions & 2 deletions R/build-home-authors.R
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ citation_auto <- function(pkg) {
)
}

# helpers -----------------------------------------------------------------
# helpers -------------------------------------------------------------------------

# Not strictly necessary, but produces a simpler data structure testing
remove_orcid <- function(x) {
Expand All @@ -301,4 +301,4 @@ remove_orcid <- function(x) {
names(out) <- NULL
}
out
}
}
9 changes: 9 additions & 0 deletions R/build-home-index.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ build_home_index <- function(pkg = ".", quiet = TRUE) {
data <- data_home(pkg)

if (is.null(src_path)) {
cli::cli_inform("Reading {.file DESCRIPTION}")
data$index <- linkify(pkg$desc$get_field("Description", ""))
} else {
cli::cli_inform("Reading {src_path(path_rel(src_path, pkg$src_path))}")
local_options_link(pkg, depth = 0L)
data$index <- markdown_body(src_path)
}

cur_digest <- file_digest(dst_path)
render_page(pkg, "home", data, "index.html", quiet = quiet)

strip_header <- isTRUE(pkg$meta$home$strip_header)
Expand All @@ -28,6 +32,11 @@ build_home_index <- function(pkg = ".", quiet = TRUE) {
logo = logo_path(pkg, depth = 0)
)

new_digest <- file_digest(dst_path)
if (cur_digest != new_digest) {
writing_file(path_rel(dst_path, pkg$dst_path), "index.html")
}

invisible()
}

Expand Down
Loading

0 comments on commit d5b2991

Please sign in to comment.