diff --git a/R/build-articles.R b/R/build-articles.R index 1f4292512..ceb406d93 100644 --- a/R/build-articles.R +++ b/R/build-articles.R @@ -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}}" ) } @@ -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() ) } diff --git a/R/build-favicons.R b/R/build-favicons.R index a151c5bf4..066f4dfb7 100644 --- a/R/build-favicons.R +++ b/R/build-favicons.R @@ -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." ) } @@ -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() diff --git a/R/build-reference.R b/R/build-reference.R index 3e41e75aa..66a62e23e 100644 --- a/R/build-reference.R +++ b/R/build-reference.R @@ -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 } diff --git a/R/build-search-docs.R b/R/build-search-docs.R index c5264ff08..012b93986 100644 --- a/R/build-search-docs.R +++ b/R/build-search-docs.R @@ -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, diff --git a/R/build.R b/R/build.R index b185dc1b2..f455f9b31 100644 --- a/R/build.R +++ b/R/build.R @@ -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 } @@ -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() @@ -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) } diff --git a/R/preview.R b/R/preview.R index f4e7fc9d6..130392896 100644 --- a/R/preview.R +++ b/R/preview.R @@ -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")) } diff --git a/R/rd-html.R b/R/rd-html.R index 2cf26a412..712f97501 100644 --- a/R/rd-html.R +++ b/R/rd-html.R @@ -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) { diff --git a/R/render.R b/R/render.R index ec90fcb96..81ebb5a00 100644 --- a/R/render.R +++ b/R/render.R @@ -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() ) } @@ -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( diff --git a/R/rmarkdown.R b/R/rmarkdown.R index 52c937f37..4f1b8308f 100644 --- a/R/rmarkdown.R +++ b/R/rmarkdown.R @@ -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)}") @@ -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 ) } diff --git a/tests/testthat/_snaps/build-reference.md b/tests/testthat/_snaps/build-reference.md index 9a9574a20..31f9b6a92 100644 --- a/tests/testthat/_snaps/build-reference.md +++ b/tests/testthat/_snaps/build-reference.md @@ -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. diff --git a/tests/testthat/_snaps/check.md b/tests/testthat/_snaps/check.md index 769719da0..d90010d88 100644 --- a/tests/testthat/_snaps/check.md +++ b/tests/testthat/_snaps/check.md @@ -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 diff --git a/tests/testthat/_snaps/rd-html.md b/tests/testthat/_snaps/rd-html.md index f0d2fb04a..16c6be23d 100644 --- a/tests/testthat/_snaps/rd-html.md +++ b/tests/testthat/_snaps/rd-html.md @@ -49,7 +49,7 @@ 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 @@ -57,7 +57,7 @@ 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 @@ -65,7 +65,7 @@ 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 @@ -73,7 +73,7 @@ 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 diff --git a/tests/testthat/_snaps/rmarkdown.md b/tests/testthat/_snaps/rmarkdown.md index e5f92a0f7..adee21568 100644 --- a/tests/testthat/_snaps/rmarkdown.md +++ b/tests/testthat/_snaps/rmarkdown.md @@ -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: