[LON-CAPA-cvs] cvs: loncom /interface lonspeller.pm
www
lon-capa-cvs@mail.lon-capa.org
Fri, 23 Jul 2004 19:47:57 -0000
www Fri Jul 23 15:47:57 2004 EDT
Modified files:
/loncom/interface lonspeller.pm
Log:
Leave HTML tags alone and do not try to spellcheck equations
Index: loncom/interface/lonspeller.pm
diff -u loncom/interface/lonspeller.pm:1.4 loncom/interface/lonspeller.pm:1.5
--- loncom/interface/lonspeller.pm:1.4 Thu Jul 22 19:50:55 2004
+++ loncom/interface/lonspeller.pm Fri Jul 23 15:47:57 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Interface routines for Aspell
#
-# $Id: lonspeller.pm,v 1.4 2004/07/22 23:50:55 www Exp $
+# $Id: lonspeller.pm,v 1.5 2004/07/23 19:47:57 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -30,9 +30,12 @@
package Apache::lonspeller;
+use Apache::Constants qw(:common);
use Text::Aspell;
use Apache::lonlocal;
+use HTML::LCParser;
use strict;
+
my $speller;
sub spellcheck_language {
@@ -48,7 +51,7 @@
$speller->set_option('lang',$lang);
}
-sub markeduptext {
+sub textsection {
my $input=shift;
my $output='';
&set_language();
@@ -72,6 +75,27 @@
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 {
unless (defined($speller)) {
$speller = Text::Aspell->new;