#-*- perl -*-
#
# Translate KEYWORDS.db to HTML
#
sub searchKey {
my $key=$_[0];
my $retval = "$key";
return($retval);
}
@key = ();
while(<>){
s/#.*//;
chop;
push(@key, $_) if $_;
}
@key = sort(@key);
$depth=0;
print("
\n");
for($k=0;$k<=$#key; $k++){
($keywords, $desc) = split(':', $key[$k]);
@keywords = split('\|', $keywords);
if($#keywords==0){
for($n=0; $n<$depth-$#keywords; $n++){
print "";
}
print "\n" if($depth);
print "
- $desc
\n- \n";
}
else{
for($n=0; $n<$#keywords ; $n++){
print " ";
}
if($#keywords > $depth){
print "
- ";
print searchKey($keywords[$#keywords]);
print ": $desc
\n";
}
elsif($#keywords < $depth){
for($n=0; $n<$depth-$#keywords; $n++){
print "
";
}
print "\n";
}
else{
print "- ", searchKey($keywords[$#keywords]);
print ": $desc
\n";
}
}
$depth=$#keywords;
}
for($n=0; $n<$depth; $n++){
print "";
}
print "
\n";