version 1.4, 2000/11/30 10:11:47
|
version 1.6, 2000/11/30 16:22:13
|
Line 14 use Apache::File;
|
Line 14 use Apache::File;
|
use Apache::Constants qw(:common :http :methods); |
use Apache::Constants qw(:common :http :methods); |
use HTML::TokeParser; |
use HTML::TokeParser; |
use Apache::lonxml; |
use Apache::lonxml; |
|
use Apache::lonhomework; |
|
|
my %addid; |
my %addid; |
|
my %nokey; |
|
|
sub publish { |
sub publish { |
|
|
Line 143 sub publish {
|
Line 145 sub publish {
|
} |
} |
# -------------------------------------------------- Parse content for metadata |
# -------------------------------------------------- Parse content for metadata |
|
|
my $allmeta=Apache::lonxml::xmlparse('meta',$content); |
my $allmeta=''; |
|
if ($source=~/\.problem$/) { |
|
$allmeta=Apache::lonhomework::subhandler('meta',$content); |
|
} else { |
|
$allmeta=Apache::lonxml::xmlparse('meta',$content); |
|
} |
|
|
|
# DEBUG: |
|
|
$scrout=$allmeta; |
$scrout=$allmeta; |
|
|
|
# --------------------------------------------------- Scan content for keywords |
|
{ |
|
my $textonly=$content; |
|
$textonly=~s/\<script[^\<]+\<\/script\>//g; |
|
$textonly=~s/\<m\>[^\<]+\<\/m\>//g; |
|
$textonly=~s/\<[^\>]*\>//g; |
|
$textonly=~tr/A-Z/a-z/; |
|
$textonly=~s/[\$\&][a-z]\w*//g; |
|
$textonly=~s/[^a-z\s]//g; |
|
|
|
my %keywords=(); |
|
map { |
|
unless ($nokey{$_}) { |
|
$keywords{$_}=1; |
|
} |
|
} ($textonly=~m/(\w+)/g); |
|
|
|
# DEBUG: |
|
|
|
$scrout.=join('<br>',sort keys %keywords); |
|
|
|
} |
|
|
|
|
} |
} |
return $scrout; |
return $scrout; |
} |
} |
Line 213 sub handler {
|
Line 246 sub handler {
|
$addid{$1}=$2; |
$addid{$1}=$2; |
} |
} |
} |
} |
|
|
|
%nokey=(); |
|
|
|
{ |
|
my $fh=Apache::File->new($r->dir_config('lonIncludes').'/un_keyword.tab'); |
|
map { |
|
my $word=$_; |
|
chomp($word); |
|
$nokey{$word}=1; |
|
} <$fh>; |
|
} |
# ----------------------------------------------------------- Start page output |
# ----------------------------------------------------------- Start page output |
|
|
$r->content_type('text/html'); |
$r->content_type('text/html'); |