diff --git a/R/check-files.R b/R/check-files.R index 8046623..c6d8dd4 100644 --- a/R/check-files.R +++ b/R/check-files.R @@ -85,8 +85,12 @@ spell_check_description_text <- function(file, dict){ spell_check_plain(lines, dict = dict) } -spell_check_file_rd <- function(rdfile, dict){ - text <- tools::RdTextFilter(rdfile) +spell_check_file_rd <- function(rdfile, macros = NULL, dict) { + if (is.null(macros)) { + text <- tools::RdTextFilter(rdfile) + } else { + text <- tools::RdTextFilter(rdfile, macros = macros) + } Encoding(text) <- "UTF-8" spell_check_plain(text, dict = dict) } diff --git a/R/spell-check.R b/R/spell-check.R index a6525a5..0630c58 100644 --- a/R/spell-check.R +++ b/R/spell-check.R @@ -54,7 +54,12 @@ spell_check_package <- function(pkg = ".", vignettes = TRUE, use_wordlist = TRUE # Check Rd manual files rd_files <- sort(list.files(file.path(pkg$path, "man"), "\\.rd$", ignore.case = TRUE, full.names = TRUE)) - rd_lines <- lapply(rd_files, spell_check_file_rd, dict = dict) + macros <- tools::loadPkgRdMacros(pkg$path) + macros <- tools::loadRdMacros( + file.path(R.home("share"), "Rd", "macros", "system.Rd"), + macros = macros + ) + rd_lines <- lapply(rd_files, spell_check_file_rd, dict = dict, macros = macros) # Check 'DESCRIPTION' fields pkg_fields <- c("title", "description")