Skip to content

Commit ac7a005

Browse files
committed
add snapshot and account for url with @
1 parent a0d2807 commit ac7a005

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

R/build-home-index.R

+5-5
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ data_home_sidebar <- function(pkg = ".", call = caller_env()) {
108108
"home.sidebar.structure",
109109
default = default_sidebar_structure(),
110110
call = call
111-
)
111+
)
112112

113113
# compute all default sections
114114
default_components <- list(
@@ -122,7 +122,7 @@ data_home_sidebar <- function(pkg = ".", call = caller_env()) {
122122
)
123123

124124
needs_components <- setdiff(structure, names(default_components))
125-
custom_yaml <- config_pluck_sidebar_components(pkg, needs_components, call = call)
125+
custom_yaml <- config_pluck_sidebar_components(pkg, needs_components, call = call)
126126
custom_components <- purrr::map(custom_yaml, function(x) {
127127
sidebar_section(x$title, markdown_text_block(pkg, x$text))
128128
})
@@ -140,11 +140,11 @@ default_sidebar_structure <- function() {
140140
config_pluck_sidebar_components <- function(pkg, new_components, call = caller_env()) {
141141
base_path <- "home.sidebar.components"
142142
components <- config_pluck_list(pkg, base_path, has_names = new_components, call = call)
143-
143+
144144
for (name in names(components)) {
145145
component <- components[[name]]
146146
component_path <- paste0(base_path, ".", name)
147-
147+
148148
config_pluck_list(pkg, component_path, has_names = c("title", "text"), call = call)
149149
config_pluck_string(pkg, paste0(component_path, ".title"), call = call)
150150
config_pluck_string(pkg, paste0(component_path, ".text"), call = call)
@@ -159,7 +159,7 @@ data_home_sidebar_links <- function(pkg = ".") {
159159
links <- config_pluck(pkg, "home.links")
160160

161161
bug_reports <- pkg$desc$get_field("BugReports", default = NULL)
162-
if (grepl("@", bug_reports)) {
162+
if (grepl("@", bug_reports) && !startsWith(bug_reports, "hhtp")) {
163163
bug_reports <- paste0("mailto:", bug_reports)
164164
}
165165

tests/testthat/_snaps/build-home-index.md

+8
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,11 @@
149149
! In _pkgdown.yml, home.sidebar.components.fancy must have components "title" and "text".
150150
2 missing components: "title" and "text".
151151

152+
# allow email in BugReports
153+
154+
Code
155+
xpath_xml(html, ".//li/a")
156+
Output
157+
<a href="mailto:[email protected]">Report a bug</a>
158+
<a href="authors.html#citation">Citing testpackage</a>
159+

tests/testthat/test-build-home-index.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test_that("math is handled", {
3030
expect_equal(xpath_length(html, ".//math"), 1)
3131
})
3232

33-
test_that("data_home() validates yaml metadata", {
33+
test_that("data_home() validates yaml metadata", {
3434
data_home_ <- function(...) {
3535
pkg <- local_pkgdown_site(meta = list(...))
3636
data_home(pkg)

0 commit comments

Comments
 (0)