Mercurial > octave-nkf
comparison doc/interpreter/doccheck/spellcheck @ 10791:3140cb7a05a1
Add spellchecker scripts for Octave and run spellcheck of documentation
interpreter/doccheck: New directory for spelling/grammar scripts.
interpreter/doccheck/README: Instructions for using scripts.
interpreter/doccheck/spellcheck: Script to spellcheck a Texinfo file.
interpreter/doccheck/aspell.conf: GNU Aspell configuration file for
Octave documentation.
interpreter/doccheck/aspell-octave.en.pws: Private Aspell dictionary.
interpreter/doccheck/add_to_aspell_dict: Script to add new
Octave-specific words to
private Aspell dictionary.
interpreter/octave.texi: New @nospell macro which forces Aspell
to ignore the word marked by the macro.
interpreter/mk_doc_cache.m: Skip new @nospell macro when building
doc_cache.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sat, 17 Jul 2010 19:53:01 -0700 |
parents | |
children | 0306e572c686 |
comparison
equal
deleted
inserted
replaced
10790:01f1643dfbb1 | 10791:3140cb7a05a1 |
---|---|
1 #!/usr/bin/perl -w | |
2 | |
3 ################################################################################ | |
4 # File : spellcheck | |
5 # Purpose: Spellcheck a single Texinfo file | |
6 # written in Perl, rather than the shell, to be more portable to OS | |
7 # without good command lines such as Windows. | |
8 # Usage : spellcheck FILENAME.texi | |
9 ################################################################################ | |
10 use File::Temp ":POSIX"; | |
11 | |
12 # Initialize variables | |
13 # Octave specific configuration file for Aspell | |
14 $aspell_conf = './doccheck/aspell.conf'; | |
15 | |
16 ################################################################################ | |
17 # Parse command line arguments | |
18 if (@ARGV != 1) | |
19 { | |
20 die ("USAGE: spellcheck <filename.texi>\n", | |
21 " invoked from doc/interpreter directory\n"); | |
22 } | |
23 | |
24 ################################################################################ | |
25 # Run Aspell with Octave-specific configuration file. | |
26 # Avoid use of pipes and use temporary files for portability | |
27 $fname = shift(@ARGV); | |
28 $tmp_fname = &tmpnam(); # from File::Temp | |
29 system ("aspell --conf=$aspell_conf list < $fname > $tmp_fname"); | |
30 | |
31 if ($?) | |
32 { | |
33 unlink ($tmp_fname); | |
34 die ("Aspell command unsuccesful. Cannot continue\n"); | |
35 } | |
36 | |
37 open (FH, "<$tmp_fname") or die "Unable to open misspelled words file: $tmp_fname\n"; | |
38 while (<FH>) { $words{$_} = 1; } | |
39 close (FH); | |
40 | |
41 # Print out sorted and uniquified list of misspelled words | |
42 print sort keys(%words); | |
43 | |
44 ################################################################################ | |
45 # Clean up temporary files | |
46 unlink ($tmp_fname) or die "Unable to delete temporary file: $tmp_fname\n"; |