#! @PERL@ use File::Basename; while(<$ARGV[0]/man/*.Rd>){ $ARGV[0] =~ /([^\/]*)$/; my $pkg =$1; open(rdfile, "<$_"); undef $text; while(){ $text .= $_; } close rdfile; $text =~ /\\name\{\s*([^\}]+)\s*\}/s; my $rdname = $1; $rdname =~ s/\n/ /sg; $text =~ /\\title\{\s*([^\}]+)\s*\}/s; my $rdtitle = $1; $rdtitle =~ s/\n/ /sg; undef @keywords; while($text =~ s/\\alias\{\s*(.*)\s*\}//){ $keyword = $1; $keyword =~ s/\\%/%/g; push @keywords, $keyword; } while($text =~ s/\\keyword\{\s*(.*)\s*\}//){ $keyword = $1; $keyword =~ s/\\%/%/g; push @keywords, $keyword; } $, = " "; print "Entry: $rdname\n"; print "Keywords: @keywords\n"; print "Description: $rdtitle\n"; print "URL: ../../../library/$pkg/html/$rdname.html\n\n"; }