Skip to content

Commit

Permalink
Respond to review
Browse files Browse the repository at this point in the history
  • Loading branch information
jayhesselberth committed Nov 30, 2023
1 parent a1c756a commit 6f1ca8e
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 28 deletions.
5 changes: 2 additions & 3 deletions R/build-articles.R
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ build_article <- function(name,
vig <- match(name, pkg$vignettes$name)
if (is.na(vig)) {
cli::cli_abort(
"Can't find article {.file {name}}",
call = caller_env()
"Can't find article {.file {name}}"
)
}

Expand Down Expand Up @@ -372,7 +371,7 @@ data_articles_index <- function(pkg = ".") {

if (length(missing) > 0) {
cli::cli_abort(
"{cli::qty(missing)} Vignette{?s} missing from index: {.file {missing}}",
"{length(missing)} vignette{?s} missing from index: {.file {missing}}.",
call = caller_env()
)
}
Expand Down
10 changes: 3 additions & 7 deletions R/build-favicons.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ build_favicons <- function(pkg = ".", overwrite = FALSE) {

if (is.null(logo_path)) {
cli::cli_abort(
"Can't find package logo PNG or SVG to build favicons.",
call = caller_env()
"Can't find package logo PNG or SVG to build favicons."
)
}

Expand Down Expand Up @@ -79,13 +78,10 @@ build_favicons <- function(pkg = ".", overwrite = FALSE) {
result <- content$favicon_generation_result

if (!identical(result$result$status, "success")) {
cli::cli_abort(
c(
cli::cli_abort(c(
"API request failed.",
"i" = "{.href [Please submit a bug report](https://github.com/r-lib/pkgdown/issues)}"
),
call = caller_env()
)
))
}

tmp <- tempfile()
Expand Down
2 changes: 1 addition & 1 deletion R/build-reference.R
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ build_reference <- function(pkg = ".",
lifecycle::deprecate_warn(
"1.4.0",
"build_site(document)",
details = "Please use `build_site(devel)` instead."
details = "build_site(devel)"
)
devel <- document
}
Expand Down
2 changes: 1 addition & 1 deletion R/build-search-docs.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ url_node <- function(url) {
build_search <- function(pkg = ".",
override = list()) {
pkg <- section_init(pkg, depth = 1L, override = override)
cli::cli_inform("Building search index")
cli::cli_rule("Building search index")
search_index <- build_search_index(pkg)
jsonlite::write_json(
search_index,
Expand Down
6 changes: 3 additions & 3 deletions R/build.R
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ build_site <- function(pkg = ".",
lifecycle::deprecate_warn(
"1.4.0",
"build_site(document)",
details = "Please use `build_site(devel)` instead."
details = "build_site(devel)"
)
devel <- document
}
Expand Down Expand Up @@ -408,7 +408,7 @@ build_site_external <- function(pkg = ".",
timeout = getOption('pkgdown.timeout', Inf)
)

cli::cli_rule(paste0("finished building pkgdown site for package ", cli::col_blue(pkg$package)))
cli::cli_rule(paste0("Finished building pkgdown site for package ", cli::col_blue(pkg$package)))

preview_site(pkg, preview = preview)
invisible()
Expand Down Expand Up @@ -453,6 +453,6 @@ build_site_local <- function(pkg = ".",
build_search(pkg, override = override)
}

cli::cli_rule(paste0("finished building pkgdown site for package ", cli::col_blue(pkg$package)))
cli::cli_rule(paste0("Finished building pkgdown site for package ", cli::col_blue(pkg$package)))
preview_site(pkg, preview = preview)
}
2 changes: 1 addition & 1 deletion R/preview.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ preview_site <- function(pkg = ".", path = ".", preview = NA) {
}

if (preview) {
cli::cli_alert("Previewing site")
cli::cli_alert_info("Previewing site")
utils::browseURL(path(pkg$dst_path, path, "index.html"))
}

Expand Down
2 changes: 1 addition & 1 deletion R/rd-html.R
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ parse_opts <- function(string) {
stop_bad_tag <- function(tag, msg = NULL) {
bad_tag <- paste0("\\", tag, "{}")
msg_abort <- 'Failed to parse tag {.val {bad_tag}}.'
cli::cli_abort(c(msg_abort, i = msg), call = caller_env())
cli::cli_abort(c(msg_abort, i = msg), call = NULL)
}

is_newline <- function(x, trim = FALSE) {
Expand Down
7 changes: 5 additions & 2 deletions R/render.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ check_open_graph <- function(og) {
if (!is.list(og)) {
fog <- friendly_type_of(og)
cli::cli_abort(
"{.var opengraph} must be a list, not {.val fog}",
"{.var opengraph} must be a list, not {.val fog}.",
call = caller_env()
)
}
Expand All @@ -169,7 +169,10 @@ check_open_graph <- function(og) {
)
}
if (!is.list(og$twitter)) {
cli::cli_abort("The {.var opengraph: twitter} option must be a list.")
cli::cli_abort(
"The {.var opengraph: twitter} option must be a list.",
call = caller_env()
)
}
if (is.null(og$twitter$creator) && is.null(og$twitter$site)) {
cli::cli_abort(
Expand Down
7 changes: 5 additions & 2 deletions R/rmarkdown.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ render_rmarkdown <- function(pkg, input, output, ..., copy_images = TRUE, quiet
output_path <- path_abs(output, pkg$dst_path)

if (!file_exists(input_path)) {
cli::cli_abort("Can't find {src_path(input)", call = caller_env())
cli::cli_abort("Can't find {src_path(input).", call = caller_env())
}

cli::cli_inform("Reading {src_path(input)}")
Expand Down Expand Up @@ -39,7 +39,10 @@ render_rmarkdown <- function(pkg, input, output, ..., copy_images = TRUE, quiet
),
error = function(cnd) {
cli::cli_abort(
"Failed to render RMarkdown document",
c(
"Failed to render RMarkdown document.",
x = gsub("\r", "", cnd$stderr, fixed = TRUE)
),
parent = cnd
)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/build-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
! Failed to parse Rd in 'f.Rd'
Caused by error in `purrr::map()`:
i In index: 4.
Caused by error in `.f()`:
Caused by error:
! Failed to parse tag "\\url{}".
i Check for empty \url{} tags.

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/check.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
check_pkgdown(pkg)
Condition
Error in `check_pkgdown()`:
! Vignettes missing from index: 'articles/nested' and 'width'
! 2 vignettes missing from index: 'articles/nested' and 'width'.

# informs if everything is ok

Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/_snaps/rd-html.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,31 @@
Condition
Error in `purrr::map_chr()`:
i In index: 1.
Caused by error in `.f()`:
Caused by error:
! Failed to parse tag "\\url{}".
i Check for empty \url{} tags.
Code
rd2html("\\url{a\nb}")
Condition
Error in `purrr::map_chr()`:
i In index: 1.
Caused by error in `.f()`:
Caused by error:
! Failed to parse tag "\\url{}".
i This may be caused by a \url tag that spans a line break.
Code
rd2html("\\email{}")
Condition
Error in `purrr::map_chr()`:
i In index: 1.
Caused by error in `.f()`:
Caused by error:
! Failed to parse tag "\\email{}".
i empty
Code
rd2html("\\linkS4class{}")
Condition
Error in `purrr::map_chr()`:
i In index: 1.
Caused by error in `.f()`:
Caused by error:
! Failed to parse tag "\\linkS4class{}".

# \describe items can contain multiple paragraphs
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/_snaps/rmarkdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
Reading assets/pandoc-fail.Rmd
Condition
Error in `render_rmarkdown()`:
! Failed to render RMarkdown document
! Failed to render RMarkdown document.
x [WARNING] Could not fetch resource path-to-image.png Failing because there were warnings.
Caused by error:
! in callr subprocess.
Caused by error:
Expand Down

0 comments on commit 6f1ca8e

Please sign in to comment.