Next: Data Structures, Previous: Filter Interface, Up: Top

## 12 Filter Modes

Filter modes are the preferred way to specify combinations of filters which are used regularly and thus abbreviate Aspell's command line arguments.

A new filter mode is specified by a file named like the filter new mode and prefixed by `.amf` (Aspell Mode File). If such a file is accessible by the path set via filter-path option Aspell will try to load the contained mode specification.

### 12.1 Aspell Mode File

The first key in the made file has be the `mode` key. It is checked against the mode name part of the .amf file. If the `mode` key is missing mode file will be rejected.

The same holds for the `aspell` key which specifies the version(s) of Aspell which is(are) required by the filter.

If these two keys are followed by at least one `magic` key Aspell will be able to select the entire mode from extension and if required from contents of the file to spell implicitly.

The last key of the required keys is the `des[c[ription]]` key. It gives a short description of the filter mode which will displayed when type `aspell help`.

The rest of the file consists of the keys `filter` and `option` to load filters are set various options.

#### 12.1.1 Version Line

Each version line must start with `aspell` and be followed by a version, optionally prefixed by a relational operator. The relation operator can be one of `<', `<=', `=', `>=' or '>' for allowing Aspell version with version number being lower, lower or equal, equal to, greater or equal or greater than required version number, respectfully. If the relation operator is omitted `=' is assumed.

#### 12.1.2 Magic Line

The magic line contains a description which requirements files have to fulfill in order to implicitly activate the entire mode at least one such line is required. Each magic line has the following format:

         MAGIC /<magic key>/<fileextention>[/<fileextention>]

The magic key consist of three `:' separated fields. The first two are byte counts the last is a regular expression. The first byte count indicates the first byte the regular expression will be applied to the second byte count indicates the number of bytes to test against the regular expression.

If mode selection should only occurred on basis of the listed file extensions the magic key should consist of the “<noregex>” special string.

At least one <fileextention> is required per MAGIC line. <fileextention> may not be empty and should not contain a leading `.' as this is assumed implicitly.

Multiple MAGIC lines are allowed. Modes may be extended limited by additional <label>.amf files located in –filter-path Thus file extensions may be prefixed by `+' or `-' to indicate that the entire extension has to be added ore removed from this <magic key> if neither is specified than a `+' is assumed implicitly.

#### 12.1.3 Description Line

The required description line will be printed when typing `aspell help`. Keep it as short as possible. Possible abbreviations are `des` and `desc`.

#### 12.1.4 Filter and Option Lines

The `filter` and `option` keys load filters and set filter options.

The value of the `filter` key is equal to the value of Aspell's `[add|rem]-filter` option.

Each `option` line has the following format:

           OPTION <option> [<value>]

The format of the <option> and <value> is the same format as found in the Aspell configuration file.