Skip to content

Commit 5aced75

Browse files
committed
Changes to the spell check test so that all files can be checked which has led eventually to a change in the installation instructions to allow for local spell check. *Warning* this commit is not checked since I'm (still) flying
1 parent b754a7c commit 5aced75

File tree

4 files changed

+47
-17
lines changed

4 files changed

+47
-17
lines changed

INSTALL.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,42 @@ If you don't have, or don't want to have, perlbrew do basically the same with su
2525
> ln -s git-hooks.pl post-commit
2626
which will get you automatic sync with GitHub pages.
2727

28-
2928
7. Get a [Travis account](http://travis-ci.org) and activate the
3029
service hook for your project. We are going to use this for
31-
spell-check
30+
spell-check.
31+
32+
8. If you want to spell-check also in your own computer (hey, you can
33+
be in a plane and offline) you'll have to install also the Hunspell
34+
spell checker. You can do it following the instructions in [the Travis
35+
conf file](.travis.yml) (hey, if it's good enough for Travis, it must
36+
be good enough for you), that is:
37+
> sudo apt-get install libhunspell-1.3-0 hunspell-en-us libhunspell-dev
38+
And then the modules mentioned in [the module
39+
Makefile.PL](Makefile.PL), that is
40+
> cpan Text::Hunspell
41+
> cpan Lingua::EN::Fathom
42+
with the obvious *sudo* in front if you don't use perlbrew.
3243

33-
8. Edit (text/words.dic) for the specific words in your novel that
44+
9. Edit (text/words.dic) for the specific words in your novel that
3445
should pass the spell check, but do not. Remember that the first line
3546
contains the number of words.
3647

37-
9. There's a shortcut that processed the dictionary and does commit
48+
10. There's a shortcut that processed the dictionary and does commit
3849
and push for you, it's at text/commit.pl. You can use it cirectly or
3950
do
4051
> ln -s text/commit.pl c
4152
Remember always to chmod +x commit.pl
4253

43-
10. That's it. If you find trouble along the way, just let me know by
54+
11. That's it, 10 points of it all. If you find trouble along the way, just let me know by
4455
raising [an issue](https://github.com/JJ/hoborg/issues)
4556

4657
Troubleshooting
4758
---------------
4859

49-
Remember that with the post-commit hook you'll be doing push in two
60+
Remember that with the post-commit hook you have installed you'll be
61+
doing push in two
5062
branches at the same time. If you fall behind in a local installation,
51-
you have to checkout and pull in both; you can't just do a git pull
63+
you will have to checkout and pull in both; you can't just do a git pull
5264
since you'll be doing it only on the current branch. Do
5365
> git pull
5466
> git checkout gh-pages

TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ Web and presentation
2626
The setup
2727
---------
2828

29+
- Install Text::Hunspell on the laptop.
2930
- Check the possibility of having the text annotated with commit comments and publish it automatically.
3031
- Install in laptop and create an easy installer.

Text-Hoborg/lib/Text/Hoborg.pm

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,9 @@ use strict;
55
use Carp;
66
use File::Slurp 'read_file';
77

8-
use version; our $VERSION = qv('0.0.3');
9-
10-
# Other recommended modules (uncomment to use):
11-
# use IO::Prompt;
12-
# use Perl6::Export;
13-
# use Perl6::Slurp;
14-
# use Perl6::Say;
8+
use version; our $VERSION = qv('0.0.4');
159

10+
our @appendices = qw(characters.md); #auxiliary and additional files
1611

1712
# Module implementation here
1813
sub new {
@@ -21,7 +16,14 @@ sub new {
2116
my $text_file = "$dir/text.md";
2217
my $text = read_file($text_file);
2318
my $self = { _text => $text,
24-
_text_file => $text_file };
19+
_text_file => $text_file,
20+
_appendices => {}
21+
};
22+
for my $a (@appendices ) {
23+
$text_file = "$dir/$a";
24+
$text = read_file($text_file);
25+
$self->{'_appendices'}{$a} = $text;
26+
}
2527
bless $self, $class;
2628
return $self;
2729
}
@@ -36,7 +38,13 @@ sub text_file {
3638
return $self->{'_text_file'};
3739
}
3840

39-
1; # Magic true value required at end of module
41+
sub appendices {
42+
return $self->{'_appendices'};
43+
}
44+
45+
46+
"All over, all out, all over and out"; # Magic circus phrase
47+
4048
__END__
4149
4250
=head1 NAME

Text-Hoborg/t/00.load.t

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,16 @@ my @words = split /\s+/, $hoborg->text;
2626

2727
for my $w (@words) {
2828
my ($stripped_word) = ( $w =~ /([\w\'áéíóúÁÉÍÓÚñÑ]+)/ );
29-
ok( $speller->check( $stripped_word), "Checking $stripped_word") if ( $stripped_word ) ;
29+
ok( $speller->check( $stripped_word), "Checking $stripped_word in text") if ( $stripped_word ) ;
3030
}
31+
32+
for my $a (keys %{$hoborg->appendices()}) {
33+
@words = split /\s+/, $hoborg->appendices()->{$a};
34+
for my $w (@words) {
35+
($stripped_word) = ( $w =~ /([\w\'áéíóúÁÉÍÓÚñÑ]+)/ );
36+
ok( $speller->check( $stripped_word), "Checking $stripped_word in $a") if ( $stripped_word ) ;
37+
}
38+
}
39+
3140
done_testing();
3241

0 commit comments

Comments
 (0)