Skip to content
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

Escape html in comments in author info from DESCRIPTION #1204

Merged
merged 7 commits into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# pkgdown (development version)

* pkgdown now escapes html and linkifies links in comments in author info from DESCRIPTION (@maelle, #1204)

* pkgdown now uses the ORCiD logo included in Font Awesome 5.11 instead of
querying it from members.orcid.org (@bisaloo, #1153)

Expand Down
2 changes: 1 addition & 1 deletion R/build-home-authors.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ author_desc <- function(x, comment = TRUE) {
if (!is.null(x$orcid))
x$orcid,
if (comment && !is.null(x$comment) && length(x$comment) != 0)
paste0("<br/>\n<small>(", x$comment, ")</small>")
paste0("<br/>\n<small>(", linkify(x$comment), ")</small>")
)
}

Expand Down
11 changes: 11 additions & 0 deletions tests/testthat/test-build-home-authors.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,14 @@ test_that("names can be removed from persons", {
expect_length(remove_name(p4$comment, "ORCID"), 0)
expect_length(remove_name(p5$comment, "ORCID"), 0)
})

test_that("Comments in authors info are linkified", {
p <- list(name = "Jane Doe",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use standard tidyverse styling?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, now I think it looks like https://style.tidyverse.org/syntax.html#long-lines :-)

roles = "rev",
comment = "Jane Doe did this, see <https://httpbin.org/>")

expect_match(
author_desc(p),
" &lt;<a href='https://httpbin.org/'>https://httpbin.org/</a>&gt;)</small>"
)
})