Skip to content

Commit

Permalink
Merge branch 'main' into incl-assets
Browse files Browse the repository at this point in the history
  • Loading branch information
salim-b committed May 28, 2024
2 parents fd71d1a + 9296658 commit 3ae43e3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# pkgdown (development version)

* All external assets (JS, CSS, fonts) are now directly included in the site instead of fetched from external CDN (@salim-b, #2249)
* `build_reference_index()` now displays lifecycle badges next to the function name (#2123). You can now also use `has_lifecycle()` to select functions by their lifecycle status.
* `build_reference_index()` now displays function lifecycle badges next to the function name (#2123). The badges are extracted only from the function description. You can now also use `has_lifecycle()` to select functions by their lifecycle status.
* `build_articles()` now recognises a new `external-articles` top-level field that allows you to define articles that live in other packages (#2028).
* New light switch makes it easy for users to switch between light and dark themes for the website (based on work in bslib by @gadenbuie). For now this behaviour is opt-in with `template.light-switch: true` but in the future we may turn it on automatically. See the customization vignette for details (#1696).
* The search dropdown has been tweaked to look more like the other navbar menu items (#2338).
Expand Down
2 changes: 1 addition & 1 deletion R/build-article.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ build_article <- function(name,

default_data <- list(
pagetitle = escape_html(front$title),
toc = toc <- front$toc %||% TRUE,
toc = front$toc %||% TRUE,
opengraph = list(description = front$description %||% pkg$package),
source = repo_source(pkg, input),
filename = path_file(input),
Expand Down
4 changes: 3 additions & 1 deletion R/package.R
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@ extract_source <- function(x) {
}

extract_lifecycle <- function(x) {
fig <- extract_figure(x)
desc <- purrr::keep(x, inherits, "tag_description")
fig <- extract_figure(desc)

if (!is.null(fig) && length(fig) > 0 && length(fig[[1]]) > 0) {
path <- as.character(fig[[1]][[1]])
if (grepl("lifecycle", path)) {
Expand Down
4 changes: 2 additions & 2 deletions inst/BS5/assets/pkgdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ aside {
.row > aside {
margin: 0.5rem;
width: calc(100vw - 1rem);
background-color: $gray-100;
border-color: $border-color;
background-color: RGBA(var(--bs-body-color-rgb), 0.1);
border-color: var(--bs-border-color);
@include border-radius($border-radius);

h2:first-child {
Expand Down
15 changes: 11 additions & 4 deletions tests/testthat/test-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,18 @@ test_that("read_meta() errors gracefully if _pkgdown.yml failed to parse", {

# lifecycle ---------------------------------------------------------------

test_that("can extract lifecycle badges", {
expect_equal(
extract_lifecycle(rd_text(lifecycle::badge("deprecated"))),
"deprecated"
test_that("can extract lifecycle badges from description", {
rd_desc <- rd_text(
paste0("\\description{", lifecycle::badge("deprecated"), "}"),
fragment = FALSE
)
rd_param <- rd_text(
paste0("\\arguments{\\item{pkg}{", lifecycle::badge("deprecated"), "}}"),
fragment = FALSE
)

expect_equal(extract_lifecycle(rd_desc), "deprecated")
expect_equal(extract_lifecycle(rd_param), NULL)
})

test_that("malformed figures fail gracefully", {
Expand Down

0 comments on commit 3ae43e3

Please sign in to comment.