[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [DDR] acheck.*.pod



Le samedi 19 juillet 2003, Hamish Moffatt écrit :
> Anyway can I suggest that you first use a spelling checker on the pod
> yourself! Then if you post it again I'll try to look through it. I don't
> want to go through and point out the spelling mistakes by hand; that's
> what we have computers for. (It seems ironic that you have spelling
> mistakes in a tool designed to check spelling?!).
sorry, I thought I'd done this before sending the texts, obviously I
hadn't. It's done now...

> > textchecker - Perl script to check common localization mistakes
> 
> Is it relevant that it's a perl script? Why not just say 'Program to
> check...' or just 'check ...'?
changed, thanks.


Nicolas
-- 
#!/usr/bin/perl -w

=head1 NAME

acheck - Check common localization mistakes

=head1 SYNOPSIS

acheck [OPTIONS] FILENAME

=head1 DESCRIPTION

This program parses a file checking for syntax rules and optionally asking
Aspell for checking word spelling. It makes fix suggestions and outputs a
corrected file accordingly adding review comments if requested.

It tries to find the file type according to the extension or the first lines
and loads rules accordingly.

It displays lines when they are parse.

When an error is found, a menu is displayed. Just press Enter if you don't want
to change anything. If a choice suits you, enter the corresponding number. If
you want to fix it but no choice is correct, enter a space, then you will be
asked for a string to replace the highlighted text. The script will replace the
highlighted text with your choice and parse it again for new errors.

Here are all the available commands:

=over 4

=item I<Enter>, ignore.

Ignore.

=item I<Ctrl+L>, redraw.

Rewrite the last line, suggestions and hints.

=item I<Space>, edit.

Edit the highlighted text.

=item I<E>, edit line.

Edit the whole line.

=item I<H>, add hint.

Add the displayed hint as review comment. Use this if you want the translator
to see the corresponding warning or error but you have no correction.

=item I<N>, next line.

Skip the rest of this line.

=item I<X>, exit and discard all changes.

Quit without saving modifications, the script ask you for confirmation, you
have to enter `B<yes>' to exit otherwise parsing starts again at the current
mistake.

=item I<a>, add in dictionary.

Add the highlighted word to you personal dictionary, capitalized as it is.

=item I<l>, add lowercase in dictionary.

Lowercase the highlighted word to add it to your personal dictionary.

=item I<i>, ignore word.

Ignore the highlighted word, same as I<Enter>.

=item I<I>, ignore all.

Ignore the highlighted word and add it to your session dictionary.

=back

=head1 OPTIONS

Verbosity level:

=over 4

=item I<-q> I<--quiet>

quiet mode.

=item I<-v>

verbose, start at level I<$Debug + 1>, add more for more verbosity (see below).

=item I<--verbose n>

set verbosity level to I<n> (see below).

=back

Spell check:

=over 4

=item I<-i>, I<--spell>

check spelling with Aspell.

=item I<-d language>, I<--dict language>

use I<language> dictionary for Aspell.

=item I<-n>, I<--nospell>

don't check spelling.

=back

Mode:

=over 4

=item I<-r>, I<--review>

review mode, add comments on lines beginning with I<$Comment> after parsed
line.

=item I<-t>, I<--trans>

translator mode, don't add comments, just fix errors.

=back

others:

=over 4

=item I<--rules ruleset>

use I<ruleset> whatever the file type is.

=item I<--dump>

Dump the rules to check and exit, use this for debugging purposes.

=item I<-V>, I<--version>

print version and exit.

=item I<-h>, I<--help>

print a short usage message and exit.

=back

=head2 Verbosity Level

=over 4

=item I<0> quiet, normal

only warnings and errors

=item I<1> debug

names of subroutines

=item I<2> debug verbose

names and arguments of subroutines

=item I<3> .. I<5> debug very verbose

output parsing and checking details

=head1 SEE ALSO

acheck(5), acheck-rules(5)

=head1 AUTHOR

Nicolas Bertolissio <nico.bertol@free.fr>
  
=cut
#!/usr/bin/perl -w

=head1 NAME

.acheck - acheck script configuration file

=head1 DESCRIPTION

This is the configuration file for acheck. If it exists, it must be at the top
of your home directory (F<$HOME>). This file is optional unless you don't want
to use default values.

Lines beginning with a number sign (`B<#>') and empty lines will be ignored.
Spaces at the beginning and the end of a line will also be ignored as well as
tabulators.  If you need spaces at the end or the beginning of a value you can
use apostrophes (`B<">').
An option line starts with it's name followed by a value. An equal sign is
optional.
A comment starts with the number sign, there can be any number of spaces and/or
tab stops in front of the #.
Some possible examples:

 # this line is ignored
 option   value
 option = value                               # this is a comment
 option        "value ending with space   "

You have to escape number signs with a backslash (`B<\>') to use it in a value.

Default values are provided into square brackets, they should be suitable for
most installations.

=head1 SPELLING

Define if you want to use ispell for checking spelling and how to use it.

=over 4

=item I<check_spelling>

use Aspell for spelling if set to `B<yes>' [yes]

=item I<dictionary>

dictionary to use with Aspell, use default if empty [empty]

=item I<word_letters>

regular expression to define characters allowed to write a word, pattern matches
according locale [\w]

=item I<$review_mode>

set to `B<yes>' if you want review comments to be added in the output file
after parsed line, otherwise just fix error [no]

=back

=head1 COLORS

Set text colors for clear presentation.

The recognized colors (all of which should be fairly intuitive) are: B<clear>,
B<reset>, B<dark>, B<bold>, B<underline>, B<underscore>, B<blink>, B<reverse>,
B<concealed>, B<black>, B<red>, B<green>, B<yellow>, B<blue>, B<magenta>,
B<cyan>, B<white>, B<on_black>, B<on_red>, B<on_green>, B<on_yellow>,
B<on_blue>, B<on_magenta>, B<on_cyan>, and B<on_white>.  Case is not
significant.  Underline and underscore are equivalent, as are clear and reset,
so use whichever is the most intuitive to you.  The I<color> alone sets the
foreground color, and I<on_color> sets the background color.

Note that not all colors are supported by all terminal types, and some
terminals may not support any of these sequences.  Dark, blink, and concealed
in particular are frequently not implemented.

=over 4

=item I<error_color>

color used to highlight errors, this should highlight space characters [bold
on_red]

=item I<fix_color>

color used to highlight suggestions, this should highlight space characters
[bold on_green]

=item I<error_head_color>

color used to display the error line header [bold red]

=item I<error_color>

color used to display the suggestion line header [bold green]

=item I<comment_color>

color used for comments and hints [cyan]

=back

=head1 OTHERS

=over 4

=item I<bak_ext>

extension for backup files [bak]

=item I<comment>

comment string for review [>> ]

=item I<debug>

verbosity level [0]

=back

Verbosity Levels:

=over 4

=item I<0> quiet, normal

only warnings and errors

=item I<1> debug

names of subroutines

=item I<2> debug verbose

names and arguments of subroutines

=item I<3> .. I<5> debug very verbose

output parsing and checking details

=back

=head1 SEE ALSO

acheck(1), acheck-rules(5)

=head1 AUTHOR

Nicolas Bertolissio <nico.bertol@free.fr>
  
=cut
#!/usr/bin/perl -w

=head1 NAME

set.rules - rules set for the acheck script

=head1 DESCRIPTION

Rules set files contain rules to be check by the acheck script.

Lines beginning with a number sign (`B<#>') and empty lines will be ignored.
Spaces at the beginning and the end of a line will also be ignored as well as
tabulators.  If you need spaces at the end or the beginning of a value you can
use apostrophes (`B<">').
A comment starts with the number sign, there can be any number of spaces and/or
tab stops in front of the #.
Long lines can be broken into multiple lines ending with a backslash (`B<\>').
Some possible examples:

 # this line is ignored
 field    value
 field    value                               # this is a comment
 field         "value ending with space   "
 field    value\
          continuing on the next line

You have to escape number signs with a backslash to use it in a value and use
apostrophes if a value ends with a backslash.

Rule sets are made of lists of rules. Theses lists can be repeated a number of
times, until or while a condition happens.

A rule detects an error if the corresponding test succeeds and none of its
validation tests does. Each rule can then produce some fixes, a warning or an
error, and provide hints to help the operator to correct the error.

Parts of the text can be set as comments and so no rule and no spell check will
be performed on them.

=head1 RULE FILE SYNTAX

=head1 SYNTAX RULES

=head2 list

A list starts at a `I<list>' statement, and stops at the first `I<end_list>' or
at the end of the file.

Mandatory fields:

=over 4

=item I<type> type

=over 4

=item I<until>, perform the list until the current line matches `I<test>'

=item I<while>, perform the lint while the current line matches `I<test>'

=item I<loop>, perform the list `I<test>' times

=back

=item I<test> regex / number

A regex for `I<until>' and `I<while>' lists. The number of times the list must
be performed for `I<loop>', or `I<0>' for infinite loop.

=back

Optional fields:

=over 4

=item I<name> name

Use this to give the list a name.

=item I<spell> yes / no

Set it to `I<yes>' (default) or `I<no>', if you want or don't want spelling to
be checked in the lines matching this list. This value will be inherited by the
nested lists.

=back

Sub-rules:

=over 4

=item I<list> [name]

=item I<rule> [name]

=item I<comment> [name]

Followed by the name of the sub-rule or its definition for an anonymous
sub-rule.

=back

=head2 rule

A rule starts at a `I<rule>' statement, and stops at the first `I<end_rule>' or
at the beginning of a comment or a list.

Mandatory fields:

=over 4

=item I<type> type

=over 4

=item I<fix>, rule provides fixes and hints thought a menu

=item I<autofix>, rule fixes the mistake with no interaction

=item I<warning>, rule issues a warning

=item I<error>, rule issues an error

=item I<nop>, special rule that do nothing, no other field is required

=back

=item I<regex> regex

The regex to be match to found this error. Patterns can be captures and then
used in the `I<fix>' expression.

=item I<fix> expr

Provides a correction for the rule, this field can be repeated to provides more
than one choice. Only the first one will be used for `I<autofix>' rules.
`I<warning>' and `I<error>' do not provides fixes. The captured patterns can be
used here with variables `I<$1>', `I<$2>', and so on.

=item I<hint> text

Provides some explanations, this will be used as reviewer comments in review
mode.

=back

Optional fields:

=over 4

=item I<name> name

Use this to give the rule a name.

=item I<valid> [name]

Provides a validation test, it can be named or anonymous. For anonymous
validation, the test definition must follow.  This field can be repeated more
than once, if any of the validation test succeed, the rule does not apply.

=back

=head2 valid

A validation test starts at a `I<valid>' statement, and stops at the first
`I<end_valid>' or at the beginning of a rule, a comment, a list or another
validation test.

Mandatory field:

=over 4

=item I<pre> regex

=item I<in> regex>

=item I<post> regex

Try the regex before, in or after the match of the regex rule. At least one of
these test must be provided. If all tests are successful, the rule won't apply.

=back

Optional field:

=over 4

=item I<name> name

Use this to give the validation test a name.

=back

=head2 comment

A comment starts at a `I<comment>' statement, and stops at the first
`I<end_comment>' or at the beginning of a rule, a comment or a list.

Comments are just skipped, no other rule and no spelling are performed on them.

Mandatory field:

=over 4

=item I<skip> regex

A regex matching the text of the comment. Do not use `I<start>' and `I<stop>'
with this.

=item I<start> regex

=item I<stop> regex

Regexs defining the beginning and the end of the comment, all the text between
will be considered as comment. Do not use `I<skip>' with this.

=back

Optional fields:

=over 4

=item I<name> name

Use this to give the comment a name.

=item I<start_offset>

=item I<stop_offset>

Defines where the comment really starts or end. Values are `I<s>' for the place
the match starts, or `I<e>' for the place the match ends. Defaults are `I<s>'
for `I<start>' matches and `I<e>' for `I<stop>' matches.

=back

=head1 SEE ALSO

acheck(1), acheck(5)

=head1 AUTHOR

Nicolas Bertolissio <nico.bertol@free.fr>
  
=cut

Reply to: