I've written a patch to add a "debctrl" filter for spell-checking Debian
packaging control files (specifically the package descriptions).  I'm
not sure if it should be included in aspell proper since it's only
really useful for Debian maintainers, but if you'd like to include it
anyway, here it is.  I've also updated the aspell.1 manpage to document
it.

-- 
Society is never going to make any progress until we all learn to
pretend to like each other.
#! /bin/sh /usr/share/dpatch/dpatch-run
## 02_debctrl_filter.dpatch by Brian Nelson <[EMAIL PROTECTED]>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad --exclude=CVS --exclude=.svn ./Makefile.am 
/home/nelson/tmp/dpep-work.XX1rPC/aspell/Makefile.am
--- ./Makefile.am       2005-07-01 14:04:59.000000000 -0700
+++ /home/nelson/tmp/dpep-work.XX1rPC/aspell/Makefile.am        2005-08-01 
23:37:28.000000000 -0700
@@ -154,6 +154,7 @@
 
 ### Add the .info file your filter comes with
 optfiles = \
+  modules/filter/debctrl-filter.info\
   modules/filter/email-filter.info\
   modules/filter/tex-filter.info\
   modules/filter/sgml-filter.info\
@@ -167,6 +168,7 @@
   modules/filter/modes/html.amf \
   modules/filter/modes/sgml.amf \
   modules/filter/modes/tex.amf \
+  modules/filter/modes/debctrl.amf \
   modules/filter/modes/email.amf \
   modules/filter/modes/ccpp.amf \
   modules/filter/modes/none.amf \
@@ -184,6 +186,7 @@
 ### starting with file containing filter class definition followed by
 ### file containing filter member implementation.
 libaspell_la_SOURCES +=\
+  modules/filter/debctrl.cpp\
   modules/filter/email.cpp\
   modules/filter/tex.cpp\
   modules/filter/sgml.cpp\
@@ -198,10 +201,14 @@
 
 ### Add name of filter library containing your filter. Name always
 ### must look like lib<filtername>-filter.la see development manual
-filter_LTLIBRARIES = email-filter.la tex-filter.la\
+filter_LTLIBRARIES = debctrl-filter.la email-filter.la tex-filter.la\
                     sgml-filter.la context-filter.la\
                      nroff-filter.la texinfo-filter.la
 
+debctrl_filter_la_SOURCES = modules/filter/debctrl.cpp
+debctrl_filter_la_LIBADD = libaspell.la 
+debctrl_filter_la_LDFLAGS  = ${filter_ldflags}
+
 email_filter_la_SOURCES = modules/filter/email.cpp
 email_filter_la_LIBADD = libaspell.la 
 email_filter_la_LDFLAGS  = ${filter_ldflags}
diff -urNad --exclude=CVS --exclude=.svn ./modules/filter/debctrl-filter.info 
/home/nelson/tmp/dpep-work.XX1rPC/aspell/modules/filter/debctrl-filter.info
--- ./modules/filter/debctrl-filter.info        1969-12-31 16:00:00.000000000 
-0800
+++ /home/nelson/tmp/dpep-work.XX1rPC/aspell/modules/filter/debctrl-filter.info 
2005-08-01 23:37:28.000000000 -0700
@@ -0,0 +1,9 @@
+# debctrl filter option file
+
+#This Filter is usable with the following version(s) of Aspell
+ASPELL >=0.51
+
+#This line will be printed when typing `Aspell help debctrl
+DESCRIPTION filter for Debian packaging control files
+
+STATIC filter
diff -urNad --exclude=CVS --exclude=.svn ./modules/filter/debctrl.cpp 
/home/nelson/tmp/dpep-work.XX1rPC/aspell/modules/filter/debctrl.cpp
--- ./modules/filter/debctrl.cpp        1969-12-31 16:00:00.000000000 -0800
+++ /home/nelson/tmp/dpep-work.XX1rPC/aspell/modules/filter/debctrl.cpp 
2005-08-01 23:37:28.000000000 -0700
@@ -0,0 +1,76 @@
+// This file is part of The New Aspell
+//
+// Copyright (C) 2005 by Brian Nelson, based on the email filter,
+// Copyright (C) 2001 by Kevin Atkinson under the GNU LGPL license
+// version 2.0 or 2.1.  You should have received a copy of the LGPL
+// license along with this library if you did not you can find it at
+// http://www.gnu.org/.
+
+#include "settings.h"
+
+#include "indiv_filter.hpp"
+#include "convert.hpp"
+#include "config.hpp"
+#include "indiv_filter.hpp"
+
+namespace {
+
+  using namespace acommon;
+
+  class DebctrlFilter : public IndividualFilter 
+  {
+    bool prev_newline;
+    bool in_field;
+
+  public:
+    PosibErr<bool> setup(Config *);
+    void reset();
+    void process(FilterChar * &, FilterChar * &);
+  };
+
+  PosibErr<bool> DebctrlFilter::setup(Config * opts) 
+  {
+    name_ = "debctrl-filter";
+    order_num_ = 0.90;
+    reset();
+    return true;
+  }
+  
+  void DebctrlFilter::reset() 
+  {
+    prev_newline = true;
+    in_field = false;
+  }
+
+  void DebctrlFilter::process(FilterChar * & str, FilterChar * & end)
+  {
+    FilterChar * line_begin = str;
+    FilterChar * cur = str;
+
+    while (cur < end) {
+      if (prev_newline && *cur != ' ')
+        in_field = true;
+
+      if (*cur == '\n') {
+       if (in_field) {
+         for (FilterChar * i = line_begin; i != cur; ++i)
+           *i = ' ';
+       }
+       line_begin = cur;
+       in_field = false;
+       prev_newline = true;
+      } else {
+       prev_newline = false;
+      }
+      ++cur;
+    }
+    if (in_field)
+      for (FilterChar * i = line_begin; i != cur; ++i)
+       *i = ' ';
+  }
+}
+
+C_EXPORT 
+IndividualFilter * new_aspell_debctrl_filter() {
+  return new DebctrlFilter;                                
+}
diff -urNad --exclude=CVS --exclude=.svn ./modules/filter/modes/debctrl.amf 
/home/nelson/tmp/dpep-work.XX1rPC/aspell/modules/filter/modes/debctrl.amf
--- ./modules/filter/modes/debctrl.amf  1969-12-31 16:00:00.000000000 -0800
+++ /home/nelson/tmp/dpep-work.XX1rPC/aspell/modules/filter/modes/debctrl.amf   
2005-08-01 23:37:28.000000000 -0700
@@ -0,0 +1,8 @@
+MODE debctrl
+
+ASPELL >=0.60
+
+DESCRIPTION mode for Debian packaging control files
+
+FILTER url
+FILTER debctrl
diff -urNad --exclude=CVS --exclude=.svn ./prog/aspell.cpp 
/home/nelson/tmp/dpep-work.XX1rPC/aspell/prog/aspell.cpp
--- ./prog/aspell.cpp   2005-07-01 14:04:49.000000000 -0700
+++ /home/nelson/tmp/dpep-work.XX1rPC/aspell/prog/aspell.cpp    2005-08-01 
23:38:38.000000000 -0700
@@ -203,10 +203,11 @@
   {'e', "mode=email", N_("enter Email mode.")},
   {'H', "mode=html",  N_("enter HTML mode.")},
   {'t', "mode=tex",   N_("enter TeX mode.")},
-  {'n', "mode=nroff", N_("enter Nroff mode.")}
+  {'n', "mode=nroff", N_("enter Nroff mode.")},
+  {'D', "mode=debctrl", N_("enter Debctrl mode.")}
 };
 
-static const ModeAbrv *  mode_abrvs_end = mode_abrvs + 4;
+static const ModeAbrv *  mode_abrvs_end = mode_abrvs + 5;
 
 const PossibleOption * find_option(char c) {
   const PossibleOption * i = possible_options;
.TH ASPELL 1 "2004-03-03" "GNU" "Aspell Abbreviated User's Manual"
.SH NAME
aspell \- interactive spell checker
.SH SYNOPSIS
.B aspell
.I "[options] <command>"
.br
.SH "DESCRIPTION"
.B aspell
is a utility that can function as an 
.B "ispell -a"
replacement, as an independent spell checker, as a test utility to test
out Aspell features, and as a utility for managing dictionaries.
.SH COMMANDS
.I "<command>"
is one of:
.TP
.B \-?,help
display the help message
.TP
.BI "\-c,check " file
to spell-check a file
.TP
.B \-a,pipe
.I "ispell -a"
compatibility mode
.TP
.B list
produce a list of misspelled words from standard input
.TP
.B [dump] config
dump the current configuration to stdout
.TP
.BI "config " key
print the current value of an option
.TP
.B soundslike
return the soundslike equivalent for each word entered
.TP
.B filter
pass standard input through the same set of filters that would be used
to spell check a document
.TP
.B \-v,version
print version number and exit
.TP
.BI "dump|create|merge master|personal|repl " "wordlist"
dump, create, or merge a master, personal, or replacement word list
.SH DICTIONARY OPTIONS
The following options may be used to control which dictionaries to use
and how they behave.
.TP
.BI "\-d,\-\-master="string
base name of the dictionary to use. If this option is specified then
Aspell will either use this dictionary or die.
.TP
.BI "\-\-dict\-dir="dir
location of the main word list 
.TP
.BI "\-l,\-\-lang="string
language to use, it follows the same format of the LANG environmental
variable on most systems. It consists of the two letter ISO 639 language
code and an optional two letter ISO 3166 country code after a dash or
underscore. The default value is based on the value of the LC_MESSAGES
locale.
.TP
.BI "\-\-size="string
the preferred size of the word list 
.TP
.BI "\-\-jargon="string
an extra information to distinguish two different word lists that have
the same lang and size.
.TP
.BI "\-\-word\-list\-path="list
search path for word list information files
.TP
.BI "\-\-module\-search\-order="list
list of available modules, modules that come first on this list have a
higher priority. Currently there is only one speller module.
.TP
.BI "\-p,\-\-personal="file
personal word list file name
.TP
.BI "\-\-repl="file
replacements list file name
.TP
.BI "\-\-extra\-dicts="list
extra dictionaries to use.
.TP
.BI "\-\-strip\-accents="boolean
strip accents from all words in the dictionary
.SH CHECKER OPTIONS
These options control the behavior of Aspell when checking documents.
.TP
.BI "\-W,\-\-ignore="integer
ignore words <= n chars 
.TP
.BI "\-\-ignore\-case="boolean
ignore case when checking words
.TP
.BI "\-\-ignore\-repl="boolean
ignore commands to store replacement pairs
.TP
.BI "\-\-save\-repl="boolean
save the replacement word list on save allkeyboard (file) the base name
of the keyboard definition file to use (see section 4.4.3)
.TP
.BI "\-\-sug\-mode="mode
suggestion mode = ultra | fast | normal | bad-spellers
.SH FILTER OPTIONS
These options modify the behavior of the various filters.
.TP
.BI "\-\-filter="list
add or removes a filter
.TP
.BI "\-\-mode="string
sets the filter mode. Mode is one if none, url, email, sgml, tex, or
debctrl, among others. (The short cut options '-e' may be used for
email, '-H' for Html/Sgml, '-t' for Tex, or '-D' for debctrl.)
.TP
.BI "\-\-encoding="string
The encoding the input text is in. Valid values are ``utf-8'',
``iso8859-*'', ``koi8-r'', ``viscii'', ``cp1252'', ``machine unsigned
16'', ``machine unsigned 32''. However, the Aspell utility will
currently only function correctly with 8-bit encodings. utf-8 support is
planned for the future. The two ``machine unsigned'' encodings are
intended to be used by other programs using the Aspell library and it
is unlikely the Aspell utility will ever support these encodings.
.TP
.BI "\-\-add|rem\-email\-quote="list
email quote characters
.TP
.BI "\-\-email\-margin="integer
number of chars that can appear before the quote char
.TP
.BI "\-\-sgml\-check="list
SGML attributes to always check
.TP
.BI "\-\-sgml\-extension="list
SGML file extensions
.TP
.BI "\-\-tex\-command="list
TeX commands
.TP
.BI "\-\-tex\-check\-comments="boolean
check TeX comments
.SH RUN\-TOGETHER WORD OPTIONS
These may be used to control the behavior of run-together words.
.TP
.BI "\-C|\-B,\-\-run-together="boolean
consider run-together words legal
.TP
.BI "\-\-run\-together\-limit="integer
maximum numbers that can be strung together
.TP
.BI "\-\-run\-together\-min="integer
minimal length of interior words
.SH MISC OPTIONS
Miscellaneous options that don't fall under any other category.
.TP
.BI "\-\-conf="file
main configuration file
.TP
.BI "\-\-conf\-dir="dir
location of main configuration file
.TP
.BI "\-\-data\-dir="dir
location of language data files
.TP
.BI "\-\-local\-data\-dir="dir
alternative location of language data files. This directory is searched
before data-dir. It defaults to the same directory the actual main word
list is in (which is not necessarily dict-dir).
.TP
.BI "\-\-home\-dir="dir
location for personal files
.TP
.BI "\-\-per\-conf="file
personal configuration file
.TP
.BI "\-\-prefix="dir
prefix directory
.SH UTILITY OPTIONS
.TP
.BI "\-b|\-x\-\-backup="boolean
create a backup file by appending 
.I .bak
to the file name. Only applies when the command is check.
.TP
.BI "\-\-time="boolean
time load time and suggest time in pipe mode.
.TP
.BI "\-\-reverse="boolean
reverse the order of the suggestions list
.TP
.BI "\-\-keymapping="string
the keymapping to use, either 
.I aspell
for the default mapping or
.I ispell
to use the same mapping that the ispell utility uses
.PP
In addition Aspell will try to make sense out of ispell's command line
options so that it can function as a drop-in replacement for ispell.  If
Aspell is run without any command line options it will display a brief help
screen and quit.
.SH CONFIGURATION
Aspell can also accept options via a personal or global configuration
file. The exact files to be used are specified by the options per-conf and
conf respectfully but the personal configuration file is normally
.I ".aspell.conf"
located in the
.B "$HOME"
directory.
.pp
Each line of the configuration file has the format:
.PP
.RS
.BI "option "[value]
.RE
.PP
where 
.B option
is any one of the standard library options above without the leading
dashes.  For example the following line will set the default language to
Swiss German:
.PP
.RS
.B lang de_CH
.RE
.PP
There may be any number of spaces between the option and the value however
it can only be spaces, i.e. there is no '=' between the option name and
the value. Comments may also be included by preceding them with a '#' as
anything from a '#' to a newline is ignored. Blank lines are also
allowed.  Values set in the personal configuration file override those
in the global file. Options specified at either the command line or via
an environmental variable override those specified by either
configuration file.
.PP
The global configuration file for Aspell is 
.I "/etc/aspell.conf"
and the per user configuration file is 
.I "~/.aspell.conf"
.SH SEE ALSO
.PP
.BR run\-with\-aspell (1),
.BR word\-list\-compress (1),
.BR aspell\-import (1)
.PP
Aspell is fully documented in its Texinfo manual.  See the
.RB "`\|" aspell "\|'"
entry in
.B info
for more complete documentation.
.SH AUTHOR
This manual page was written by Brian Nelson <[EMAIL PROTECTED]> based on
the Aspell User's Manual, Copyright \(co 2002 Kevin Atkinson.
_______________________________________________
Aspell-devel mailing list
Aspell-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/aspell-devel

Reply via email to