--- loncom/publisher/lonpublisher.pm 2000/11/30 10:11:47 1.4 +++ loncom/publisher/lonpublisher.pm 2000/11/30 16:22:13 1.6 @@ -14,8 +14,10 @@ use Apache::File; use Apache::Constants qw(:common :http :methods); use HTML::TokeParser; use Apache::lonxml; +use Apache::lonhomework; my %addid; +my %nokey; sub publish { @@ -143,10 +145,41 @@ sub publish { } # -------------------------------------------------- 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; +# --------------------------------------------------- Scan content for keywords + { + my $textonly=$content; + $textonly=~s/\//g; + $textonly=~s/\[^\<]+\<\/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('
',sort keys %keywords); + + } + + } return $scrout; } @@ -213,6 +246,17 @@ sub handler { $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 $r->content_type('text/html');