version 1.4, 2004/07/22 23:50:55
|
version 1.5, 2004/07/23 19:47:57
|
Line 30
|
Line 30
|
|
|
package Apache::lonspeller; |
package Apache::lonspeller; |
|
|
|
use Apache::Constants qw(:common); |
use Text::Aspell; |
use Text::Aspell; |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use HTML::LCParser; |
use strict; |
use strict; |
|
|
my $speller; |
my $speller; |
|
|
sub spellcheck_language { |
sub spellcheck_language { |
Line 48 sub set_language {
|
Line 51 sub set_language {
|
$speller->set_option('lang',$lang); |
$speller->set_option('lang',$lang); |
} |
} |
|
|
sub markeduptext { |
sub textsection { |
my $input=shift; |
my $input=shift; |
my $output=''; |
my $output=''; |
&set_language(); |
&set_language(); |
Line 70 sub markeduptext {
|
Line 73 sub markeduptext {
|
} |
} |
} |
} |
return $output; |
return $output; |
|
} |
|
|
|
|
|
sub markeduptext { |
|
my $input=shift; |
|
my $output=''; |
|
my $parser=HTML::LCParser->new(\$input); |
|
my $token; |
|
while ($token=$parser->get_token) { |
|
if ($token->[0] eq 'T') { |
|
$output.=&textsection($token->[1]); |
|
} elsif ($token->[0] eq 'S') { |
|
$output.=$token->[4]; |
|
if ($token->[1] eq 'm') { |
|
$output.=$parser->get_text('/m'); |
|
} |
|
} elsif ($token->[0] eq 'E') { |
|
$output.=$token->[2]; |
|
} |
|
} |
|
return $output; |
} |
} |
|
|
sub initspeller { |
sub initspeller { |