-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display inst/AUTHORS
info in authors.html
#2506
Changes from all commits
7014fb1
2f50995
076cf7e
98275da
33fbd9c
2f1d68f
f3cfee0
c0bf556
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Package: testpackage | ||
Version: 1.0.0 | ||
Title: A test package | ||
Description: A test package | ||
Authors@R: c( | ||
person("Hadley", "Wickham", , "[email protected]", role = c("aut", "cre")), | ||
person("RStudio", role = c("cph", "fnd")) | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
template: | ||
bootstrap: 5 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,15 +37,9 @@ test_that("Data authors can accept different filtering", { | |
expect_length(data_authors(pkg, roles = "cre")$main, 1) | ||
}) | ||
|
||
test_that("Text can be added", { | ||
pkg <- as_pkgdown(test_path("assets/sidebar-comment")) | ||
expect_null(data_authors_page(pkg)$after) | ||
expect_null(data_authors_page(pkg)$before) | ||
|
||
pkg$meta$authors$before <- "Dream team:" | ||
pkg$meta$authors$after <- "You are welcome!" | ||
expect_equal(data_authors_page(pkg)$before, "<p>Dream team:</p>") | ||
expect_equal(data_authors_page(pkg)$after, "<p>You are welcome!</p>") | ||
test_that("authors data includes inst/AUTHORS", { | ||
pkg <- as_pkgdown(test_path("assets/inst-authors")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would the test be easier to read if the test package were created here, with some test helper, and if the inst/authors file were then added inline in this test? I thought there was an issue about test assets but I can't find it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe as part of #2509 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think that would probably be the case for many of the tests, but requires quite a bit of test infrastructure investment. We'll see how I go. |
||
expect_equal(data_authors(pkg)$inst, "Hello") | ||
}) | ||
|
||
test_that("data_home_sidebar_authors() works with text", { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,15 @@ test_that("source link is added to citation page", { | |
expect_true(any(grepl("<code>inst/CITATION</code></a></small>", lines))) | ||
}) | ||
|
||
test_that("citation page includes inst/AUTHORS", { | ||
pkg <- local_pkgdown_site(test_path("assets/inst-authors")) | ||
suppressMessages(init_site(pkg)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #2330 will be nice 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Btw I'm not convinced it will be, because I think there are two meanings of |
||
suppressMessages(build_citation_authors(pkg)) | ||
|
||
lines <- read_lines(path(pkg$dst_path, "authors.html")) | ||
expect_true(any(grepl("<pre>Hello</pre>", lines))) | ||
}) | ||
|
||
test_that("multiple citations all have HTML and BibTeX formats", { | ||
citations <- data_citations(test_path("assets/site-citation/multi")) | ||
expect_snapshot_output(citations) | ||
|
@@ -45,3 +54,4 @@ test_that("links in curly braces in authors comments are escaped", { | |
"reviewed see <<a href='https://github.com/r-lib/pkgdown/pulls'>https://github.com/r-lib/pkgdown/pulls</a>>" | ||
) | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it need to be Markdownified? probably not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can assume this file is markdown, so the best we can do is put in a
<pre>
tag.