Skip to content

Commit

Permalink
Fix yaml author block parsing (#2789)
Browse files Browse the repository at this point in the history
Fixes #2788
  • Loading branch information
jayhesselberth authored Sep 30, 2024
1 parent 0a18bc7 commit 0cb9d38
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions R/build-home-authors.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ data_authors <- function(pkg = ".", roles = default_roles(), call = caller_env()
main = main,
inst = inst,
needs_page = more_authors || length(comments) > 0 || !is.null(inst),
before = config_pluck_markdown_block(pkg, "template.authors.before", call = call),
after = config_pluck_markdown_block(pkg, "template.authors.after", call = call)
before = config_pluck_markdown_block(pkg, "authors.before", call = call),
after = config_pluck_markdown_block(pkg, "authors.after", call = call)
))
}

Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/_snaps/build-home-authors.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
Error in `data_authors_()`:
! In _pkgdown.yml, authors must be a list, not the number 1.
Code
data_authors_(template = list(authors = list(before = 1)))
data_authors_(authors = list(before = 1))
Condition
Error in `data_authors_()`:
! In _pkgdown.yml, template.authors.before must be a string, not the number 1.
! In _pkgdown.yml, authors.before must be a string, not the number 1.
Code
data_authors_(template = list(authors = list(after = 1)))
data_authors_(authors = list(after = 1))
Condition
Error in `data_authors_()`:
! In _pkgdown.yml, template.authors.after must be a string, not the number 1.
! In _pkgdown.yml, authors.after must be a string, not the number 1.

# data_home_sidebar_authors validates yaml inputs

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-build-home-authors.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ test_that("data_authors validates yaml inputs", {

expect_snapshot(error = TRUE, {
data_authors_(authors = 1)
data_authors_(template = list(authors = list(before = 1)))
data_authors_(template = list(authors = list(after = 1)))
data_authors_(authors = list(before = 1))
data_authors_(authors = list(after = 1))
})
})

Expand Down

0 comments on commit 0cb9d38

Please sign in to comment.