Aspell now has filter support. You can either select from individual filters or choose a filter mode. To select a filter mode use the mode option. You may choose from `none', `url', `email', `sgml', `ccpp', `tex' and any other available on your system. The default mode is `url'. Individual filters can be added with the option add-filter and removed with the rem-filter option. The currently available filters are `url', `email', `sgml' and `tex', `latex' (alias for `tex'), `nroff', `context', as well as a bunch of filters which translate the text from one format to another.
To check which filters are available use aspell dump filters. To check which filter modes are available use aspell dump modes. The aspell help command will also list all available filter and filter modes.
The none mode is exactly what it says. It turns off all filters.
The url filter/mode skips over URLs, host names, and email addresses. Because this filter is almost always useful and rarely does any harm it is enabled in all modes except none. To turn it off either select the none mode or use rem-filter option after the desired mode is selected.
The email filter mode skips over quoted text. It currently does not support skipping over headers however a future version should. In the meantime I suggest you use Aspell with Newsbody which can be found at http://home.worldonline.dk/~byrial/newsbody/. The option email-skip controls the number of characters that can appear before the email quote character, the default is 10. The option add|rem-email-quote controls the characters that are considered quote characters, the defaults are `>' and `|'.
The SGML filter allows you to spell check SGML, HTML, XHTML, and XML files. In most cases everything within a tag `<tag attrib=value attrib2="a whole sentence">' will be skipped by the spell checker. The SGML/HTML/XML that Aspell supports is a slight superset of most DTDs (Document Type Definitions) and can spell check the often non-conforming HTML found on the web.
Two configuration options, sgml-skip and sgml-check, allow you to control what is spell checked. The tag and attribute names specified are case insensitive.
<TD><FONT size=2><NOSPELLCHECK>leviosa</NOSPELLCHECK> is what Mr. Potter said</FONT></TD>
And put that word in the skip config directive:
In this case `<input type=button value="Donr">' will be flagged as a misspelling.
This filter will also translate SGML characters of the form `&#num;'. Other SGML characters such as `&' will simply be skipped over so that the word `amp', for example, will not be spell checked. Eventually full support for properly translating SGML characters will be added.
The html filter is like the SGML Filter Mode but specialized for HTML. By default, 'script' and 'style' are members of the skip list in HTML mode.
The tex (all lowercase) filter mode skips over TeX commands and parameters and/or options to certain commands. It also skips over TeX comments by default. The option [dont-]tex-check-comments controls whether or not Aspell will skip over TeX comments. The option add|rem-tex-command controls which TeX commands should have certain parameters and/or options also skipped over. Commands that are not specified will have all their parameters and/or options checked. The format for each item is
<command> <a list of p,P,o and Os>
The first item is simply the command name. The second item controls which parameters to skip over. A 'p' skips over a parameter while a 'P' doesn't. Similarly an 'o' will skip over an optional parameter while an 'O' doesn't. The first letter on the list will apply to the first parameter, the second letter will apply to the second parameter etc. If there are more parameters than letters Aspell will simply check them as normal. For example the option
add-tex-command rule pp
will skip over the first two parameters of the
while the option
add-tex-command foo Pop
will check the first parameter of the
foo command, skip
over the next optional parameter, if it is present, and will skip over
the second parameter — even if the optional parameter is not present
— and will check any additional parameters.
A `*' at the end of the command is simply ignored. For example the option
will ignore the first parameter in both enlargethispage and enlargethispage*.
To remove a command simply use the rem-tex-command option. For example
will remove the command foo, if present, from the list of TeX commands.
The TeX filter mode is also available via latex alias name.
The texinfo filter allows you to spell check Texinfo files. It will skip over any Texinfo commands and their parameters when appropriate. It will also skip over some Texinfo environments such as example. The list option texinfo-ignore controls which commands to ignore the parameters of and the list option texinfo-ignore-env controls which Texinfo environments to ignore.
The Texinfo filter has special code to deal with the @table and related commands. It will apply the formatting command to each of the @item or @itemx commands just like Texinfo will. This means that if the formatting command is @code and and the @code command is a member of the texinfo-ignore option than the Texinfo filter will ignore the parameter of the @item command as if the parameter was also the parameter of the @code command.
The Texinfo filter will also skip over the `\input texinfo' line.
The nroff filter mode allows you to check the spelling of
Nroff documents. The mode is enabled by giving
--add-filter=nroff or -n command line option to
aspell. It is also automatically enabled if the first three
characters of the file being checked are
.\" (a nroff comment
marker) or the file name ends in a one of the following suffixes:
This filter mode skips following nroff language elements:
\f) and size switch (
\() and extended (
\[comp1 comp2 ...]) form.
The context filter allows Aspell to distinguish between visible and invisible contexts. The visible ones will be spell checked and the invisible ones will be ignored. The contexts are distinguished by the fact that the visible/invisible ones are delimited by specific and unique delimiter characters or character sequences. Whether the delimited contexts should be visible or invisible only stated by the value of the [dont-]context-visible-first option and not by the delimiters.
The context delimiters are specified as pairs of delimiters via the
add|rem-context-delimiters option. The delimiters enclosing
a specific context are specified as a space separated pair. If more
than one delimiter pair is specified by one call of
add|rem-context-delimiters they have to be combined to a
comma separated list. To indicate that a context is always closed by
end of line use
\0 sequence as closing delimiter.
The ccpp filter mode will limit spell checking to C/C++ comments and string literals. Any code in between will be left alone.