Rev 58549 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/utils/man/aspell-utils.Rd% Part of the R package, http://www.R-project.org% Copyright 1995-2011 R Core Team% Distributed under GPL 2 or later\name{aspell-utils}\alias{aspell-utils}\alias{aspell_package_Rd_files}\alias{aspell_package_vignettes}\alias{aspell_write_personal_dictionary_file}\title{Spell Check Utilities}\description{Utilities for spell checking packages via Aspell, Hunspell or Ispell.}\usage{aspell_package_Rd_files(dir, drop = c("\\\\author", "\\\\references"),control = list(), program = NULL)aspell_package_vignettes(dir, control = list(), program = NULL)aspell_write_personal_dictionary_file(x, out, language = "en",program = NULL)}\arguments{\item{dir}{a character string specifying the path to a package's rootdirectory.}\item{drop}{a character vector naming additional Rd sections to dropwhen selecting text via \code{\link[tools]{RdTextFilter}}.}\item{control}{a list or character vector of control options forthe spell checker.}\item{program}{a character string giving the name (if on the systempath) or full path of the spell check program to be used, or\code{NULL} (default). By default, the system path is searched for\command{aspell}, \command{hunspell} and \command{ispell} (in thatorder), and the first one found is used.}\item{x}{a character vector, or the result of a call to\code{\link{aspell}()}.}\item{out}{a character string naming the personal dictionary file towrite to.}\item{language}{a character string indicating a language as used byAspell.}}\details{\code{aspell_package_Rd_files} and \code{aspell_package_vignettes}perform spell checking on the Rd files and vignettes of the packagewith root directory \code{dir}. They determine the respective files,apply the appropriate filters, and run the spell checker.When using Aspell, the vignette checking skips parameters and/oroptions of commands \verb{\Sexpr}, \verb{\citep}, \verb{\code},\verb{\pkg}, \verb{\proglang} and \verb{\samp}. Further commands canbe added by adding \verb{--add-tex-command} options to the\code{control} argument. E.g., to skip both option and parameter of\verb{\mycmd}, add \verb{--add-tex-command='mycmd op'}.Suitable values for \code{control}, \code{program} and \code{drop} andpersonal dictionaries can also be specified using a package defaultsfile which should go as \file{defaults.R} into the \file{.aspell}subdirectory of \code{dir}, and provides defaults via assignments ofsuitable named lists, as e.g. \preformatted{ vignettes <- list(control = "--add-tex-command='mycmd op'")}for vignettes (when using Aspell) and assigning to \code{Rd_files} forRd files defaults, and using elements \code{program}, \code{drop} and\code{personal} for the respective default values.Maintainers of packages using both English and American spelling willfind it convenient to pass control options \option{--master=en_US} and\option{--add-extra-dicts=en_GB} to Aspell and \option{-d en_US,en_GB}to Hunspell (provided that the corresponding dictionaries areinstalled).One can also use personal dictionaries containing additional words tobe accepted as spelled correctly. Via\code{aspell_write_personal_dictionary_file}, a personal dictionaryfile can be created by either giving the words directly as a charactervector, or as an object from a call to \code{aspell()} (in which caseall possibly misspelled words contained in the object are taken).Most conveniently, the file is then moved to the package source\file{.aspell} subdirectory (named, e.g., \file{vignettes.pws}) andthen activated via the defaults file using, e.g., \preformatted{ vignettes <- list(control = "--add-tex-command='mycmd op'",personal = "vignettes.pws")}}\seealso{\code{\link{aspell}}}\keyword{utilities}