;
close BIB;
}
sub printgroup {
my ($name, $groups, , $files, @entries) = @_;
# First check if there are any entries for the grouping.
my $empty = 1;
CHECK: for $entry (@entries) {
my $type = $entry->[1];
if (defined($groups->{$type})) {
$empty = 0;
last CHECK;
}
}
return if ($empty);
# Have non-empty group.
print "$name
\n";
print "\n";
ENTRY: for $entry (@entries) {
# Only print entries that are in the given group (by publication type).
my $type = $entry->[1];
next ENTRY if (!defined($groups->{$type}));
print "\n- \n";
printentry($entry);
for my $ext (@{$files->{$$entry[0]}}) {
print " $ext\n";
}
print " BiBTeX\n";
print "\n
\n
\n";
}
print "
\n";
}
sub printentries {
my $web = "docs";
opendir DIR,$web or die $!;
my @files = grep {$_ ne '.' and $_ ne '..' and $_ ne 'index.html'} readdir DIR;
closedir DIR;
my %files = ();
for my $file (@files) {
my ($stem,$ext) = split /\./,$file,2;
push @{$files{$stem}},$ext;
}
my @entries = map {getentry($_)} keys %files;
@entries = sort {$$b[2]{year} cmp $$a[2]{year} or $a cmp $b} @entries;
printgroup("Journal Papers",
{"article" => 1},
\%files,
@entries);
printgroup("Conference Papers",
{"inproceedings" => 1, "conference" => 1},
\%files,
@entries);
printgroup("Technical Reports",
{"techreport" => 1},
\%files,
@entries);
printgroup("Miscellaneous Publications",
{"misc" => 1},
\%files,
@entries);
printgroup("Unpublished Work",
{"unpublished" => 1},
\%files,
@entries);
}
################################################################
# Begin main program.
################################################################
my $researcher = "Mahesh Balakrishnan";
my $email = "mahesh AT cs DOT cornell DOT edu";
#print HTML head
$q = new CGI;
print $q->header;
$bibtex = $q->param('bibtex');
if ($bibtex) {
loadbib();
print $q->start_html("${researcher}'s Publications: BiBTeX");
print $q->h1("${researcher}'s Publications: BiBTeX");
my $entry = getentry($bibtex);
print "\n";
print $$entry[3];
print "
\n";
} else {
print $q->start_html("${researcher}'s Publications");
print $q->h1("${researcher}'s Publications");
loadbib();
printentries();
}
#print "perl v$]\n";
print "
This page is automatically generated. If you find HTML errors,
citation errors, stylistic errors,
errors in the documents, or anything else wrong with this
page, please let me know at:
$email
Thanks to Art Munson for the Perl Script.";
print $q->end_html;
# to-do:
# pages for collections: JNLE: http://titles.cambridge.org/journals/journal_catalogue.asp?mnemonic=jnle
#