Skip to content

Commit

Permalink
Add more inline markup (#1607)
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy authored Jul 9, 2024
1 parent 5b7110d commit 7a1258d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion R/object-r6.R
Original file line number Diff line number Diff line change
Expand Up @@ -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\")}."
)
Expand Down
12 changes: 6 additions & 6 deletions R/roxygenize-setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ 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)

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}}"
))
}
Expand Down Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ write_if_different <- function(path, contents, command = 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)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/object-r6.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
i With name: meth1.
Caused by error:
! R6 class <foo> 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")`.

4 changes: 2 additions & 2 deletions tests/testthat/_snaps/roxygenize-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

0 comments on commit 7a1258d

Please sign in to comment.