mirror of
https://github.com/msberends/AMR.git
synced 2026-03-19 21:02:27 +01:00
Pre-evaluate inline expressions, add format_inline_(), fix print.ab
- All bare {variable}/{expression} in message_()/warning_()/stop_() calls
are now pre-evaluated via paste0(), so users without cli/glue never see
raw template syntax (mo_source.R, first_isolate.R, join_microorganisms.R,
antibiogram.R, atc_online.R)
- Add format_inline_() helper: formats a cli-markup string and returns it
(not emits it), using cli::format_inline() when available and cli_to_plain()
otherwise
- Rewrite .onAttach to use format_inline_() for all packageStartupMessage
calls; also adds {.topic} link and {.code} markup for option names
- print.ab: pre-evaluate function_name via paste0 (no .envir needed),
apply highlight_code() to each example bullet for R syntax highlighting
- join_microorganisms: pre-evaluate {type} and {nrow(...)} expressions
https://claude.ai/code/session_01XHWLohiSTdZvCutwD7ag2b
This commit is contained in:
@@ -373,7 +373,7 @@ first_isolate <- function(x = NULL,
|
||||
if (!is.null(specimen_group)) {
|
||||
check_columns_existance(col_specimen, x)
|
||||
if (isTRUE(info) && message_not_thrown_before("first_isolate", "excludingspecimen")) {
|
||||
message_("Excluding other than specimen group '{specimen_group}'")
|
||||
message_("Excluding other than specimen group '", specimen_group, "'")
|
||||
}
|
||||
}
|
||||
if (!is.null(col_keyantimicrobials)) {
|
||||
@@ -430,7 +430,8 @@ first_isolate <- function(x = NULL,
|
||||
}
|
||||
if (length(c(row.start:row.end)) == pm_n_distinct(x[c(row.start:row.end), col_mo, drop = TRUE])) {
|
||||
if (isTRUE(info)) {
|
||||
message_("=> Found {.strong {length(c(row.start:row.end))} first isolates}, as all isolates were different microbial species",
|
||||
n_rows <- length(c(row.start:row.end))
|
||||
message_("=> Found {.strong ", n_rows, " first isolates}, as all isolates were different microbial species",
|
||||
as_note = FALSE
|
||||
)
|
||||
}
|
||||
@@ -537,7 +538,7 @@ first_isolate <- function(x = NULL,
|
||||
paste0('"', x, '"')
|
||||
}
|
||||
})
|
||||
message_("\nGroup: {toString(paste0(names(group), ' = ', group))}\n",
|
||||
message_("\nGroup: ", toString(paste0(names(group), " = ", group)), "\n",
|
||||
as_note = FALSE
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user