mirror of
https://github.com/msberends/AMR.git
synced 2026-03-19 13:42:25 +01:00
Implement cli::code_highlight() for R code examples in messages (issue #191)
Add highlight_code() helper that wraps cli::code_highlight() when cli >= 3.0.0
is available, falling back to plain code otherwise. Apply it to all inline
R code examples embedded in message/warning/stop strings across the package.
Also convert remaining backtick-quoted function and argument references in
messaging calls to proper cli markup: {.help AMR::fn}(), {.arg arg},
{.code expr}, and {.pkg pkg} throughout ab.R, ab_from_text.R, av_from_text.R,
amr_selectors.R, count.R, custom_antimicrobials.R, custom_microorganisms.R,
interpretive_rules.R, mo.R, mo_property.R, sir.R, sir_calc.R.
Fixes #191
https://claude.ai/code/session_01XHWLohiSTdZvCutwD7ag2b
This commit is contained in:
2
R/ab.R
2
R/ab.R
@@ -210,7 +210,7 @@ as.ab <- function(x, flag_multiple_results = TRUE, language = get_AMR_locale(),
|
||||
progress <- progress_ticker(n = sum(!already_known), n_min = 25, print = info) # start if n >= 25
|
||||
on.exit(close(progress))
|
||||
if (any(x_new[!already_known & !is.na(x_new)] %in% unlist(AMR_env$AV_lookup$generalised_all, use.names = FALSE), na.rm = TRUE)) {
|
||||
warning_("in `as.ab()`: some input seems to resemble antiviral drugs - use `as.av()` or e.g. `av_name()` for these, not `as.ab()` or e.g. `ab_name()`.")
|
||||
warning_("in {.help AMR::as.ab}(): some input seems to resemble antiviral drugs - use {.help AMR::as.av}() or e.g. {.help AMR::av_name}() for these, not {.help AMR::as.ab}() or e.g. {.help AMR::ab_name}().")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user