From 7a6c85c987d04721720bb93ea953bbf91e0c4f9d Mon Sep 17 00:00:00 2001 From: olivroy Date: Wed, 10 Apr 2024 08:19:33 -0400 Subject: [PATCH] Add more inline markup --- R/object-r6.R | 2 +- R/roxygenize-setup.R | 12 ++++++------ R/utils.R | 2 +- tests/testthat/_snaps/object-r6.md | 2 +- tests/testthat/_snaps/roxygenize-setup.md | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/R/object-r6.R b/R/object-r6.R index 8d5d78907..a8e76bf74 100644 --- a/R/object-r6.R +++ b/R/object-r6.R @@ -51,7 +51,7 @@ extract_r6_methods <- function(x) { c( "R6 class {.cls {name}} lacks source references.", i = paste0( - "If you are using the `installed` load method in `DESCRIPTION`, then ", + "If you are using the `installed` load method in {.file DESCRIPTION}, then ", "try re-installing the package with option '--with-keep.source', e.g. ", "{.code install.packages(..., INSTALL_OPTS = \"--with-keep.source\")}." ) diff --git a/R/roxygenize-setup.R b/R/roxygenize-setup.R index 468b87ef7..045e001bf 100644 --- a/R/roxygenize-setup.R +++ b/R/roxygenize-setup.R @@ -9,7 +9,7 @@ roxygen_setup <- function(path = ".", is_first <- first_time(path) if (is_first) { - cli::cli_inform("First time using roxygen2. Upgrading automatically...") + cli::cli_inform("First time using {.pkg roxygen2}. Upgrading automatically...") } update_roxygen_version(path, cur_version = cur_version) @@ -17,7 +17,7 @@ roxygen_setup <- function(path = ".", encoding <- desc::desc_get("Encoding", path)[[1]] if (!identical(encoding, "UTF-8")) { cli::cli_inform(c( - x = "roxygen2 requires {.val Encoding: UTF-8}", + x = "{.pkg roxygen2} requires {.val Encoding: UTF-8}", i = "Current encoding is {.val {encoding}}" )) } @@ -49,21 +49,21 @@ update_roxygen_version <- function(path, cur_version = NULL) { if (!is.na(cur) && !is.na(prev) && package_version(cur) < package_version(prev)) { cli::cli_inform(c( - x = "Installed roxygen2 is older than the version used with this package", - i = "You have {.str {cur}} but you need {.str {prev}}" + x = "Installed {.pkg roxygen2} is older than the version used with this package", + i = "You have {.val {cur}} but you need {.val {prev}}" )) } else if (!identical(cur, prev)) { if (!is.na(prev) && numeric_version(prev) <= "6.1.99") { cli::cli_rule() cli::cli_inform(c( - "Changes in roxygen2 7.0.0:", + "Changes in {.pkg roxygen2} 7.0.0:", "* `%` is now escaped automatically in Markdown mode.", "Please carefully check .Rd files for changes" )) cli::cli_rule() } - cli::cli_inform("Setting {.var RoxygenNote} to {.str {cur}}") + cli::cli_inform(c(i = "Setting {.field RoxygenNote} to {.val {cur}}")) desc::desc_set(RoxygenNote = cur, file = path) } } diff --git a/R/utils.R b/R/utils.R index b1ccc91c0..cc2f5828b 100644 --- a/R/utils.R +++ b/R/utils.R @@ -70,7 +70,7 @@ write_if_different <- function(path, contents, href = NULL, check = TRUE) { if (check && !made_by_roxygen(path)) { cli::cli_inform(c( x = "Skipping {.path {name}}", - i = "It already exists and was not generated by roxygen2." + i = "It already exists and was not generated by {.pkg roxygen2}." )) return(FALSE) } diff --git a/tests/testthat/_snaps/object-r6.md b/tests/testthat/_snaps/object-r6.md index d05fa768c..ec03a8daa 100644 --- a/tests/testthat/_snaps/object-r6.md +++ b/tests/testthat/_snaps/object-r6.md @@ -8,5 +8,5 @@ i With name: meth1. Caused by error: ! R6 class lacks source references. - i If you are using the `installed` load method in `DESCRIPTION`, then try re-installing the package with option '--with-keep.source', e.g. `install.packages(..., INSTALL_OPTS = "--with-keep.source")`. + i If you are using the `installed` load method in 'DESCRIPTION', then try re-installing the package with option '--with-keep.source', e.g. `install.packages(..., INSTALL_OPTS = "--with-keep.source")`. diff --git a/tests/testthat/_snaps/roxygenize-setup.md b/tests/testthat/_snaps/roxygenize-setup.md index 1fb49428d..a483d96a8 100644 --- a/tests/testthat/_snaps/roxygenize-setup.md +++ b/tests/testthat/_snaps/roxygenize-setup.md @@ -12,7 +12,7 @@ roxygen_setup(path, cur_version = "8.0.0") Message First time using roxygen2. Upgrading automatically... - Setting `RoxygenNote` to "8.0.0" + i Setting RoxygenNote to "8.0.0" Output [1] TRUE @@ -46,7 +46,7 @@ * `%` is now escaped automatically in Markdown mode. Please carefully check .Rd files for changes -------------------------------------------------------------------------------- - Setting `RoxygenNote` to "8.0.0" + i Setting RoxygenNote to "8.0.0" Output [1] FALSE