[Commits] [svn:einsteintoolkit] www/info/citing/ (Rev. 421)
knarf at cct.lsu.edu
knarf at cct.lsu.edu
Sat Nov 20 23:47:09 CST 2010
User: knarf
Date: 2010/11/20 11:47 PM
Modified:
/info/citing/
parse_citations.pl
Log:
also print suggested
File Changes:
Directory: /info/citing/
========================
File [modified]: parse_citations.pl
Delta lines: +43 -34
===================================================================
--- info/citing/parse_citations.pl 2010-11-21 05:41:05 UTC (rev 420)
+++ info/citing/parse_citations.pl 2010-11-21 05:47:09 UTC (rev 421)
@@ -4,38 +4,47 @@
my $tmpfile = "/tmp/ET-citations.bib";
-# create bib file
-my $command = "../../bibtex/parse_bibtex.pl --input=../../manifest/einsteintoolkit.bib --filter=required-for";
-`$command > $tmpfile`;
-# get bibtex key list
-my $keys = `$command --showkey=required-for`;
-# generate preliminary html
-my $html = join("", `../../bibtex/bib2xhtml -u -s unsortlist $tmpfile`);
-unlink($tmpfile);
-# strip html frame from list
-$html=~s/.*(<!-- BEGIN BIB)/$1/s;
-$html=~s/(<!-- END BIB.*-->).*/$1/s;
-# merge key and bibtex lists
-my $delimiter = "<!-- Authors";
-my @html_arr = split($delimiter, $html); shift(@html_arr);
-my @keys_arr = split("\n", $keys);
-my @arr_of_arr = ();
-for (my $i=0; $i<scalar(@html_arr); $i++) {
- my $key_part2 = $keys_arr[$i];
- $key_part2 =~ s/[^ ]* //g;
- my $html_part = $html_arr[$i];
- $html_part =~ s/<\/?li>//g;
- $html_part =~ s/<\/ul>//g;
- my %elem = ($key_part2=>$delimiter.$html_part);
- push(@arr_of_arr, \%elem);
+sub one_filter()
+{
+ my ($filter) = @_;
+ # create bib file
+ my $command = "../../bibtex/parse_bibtex.pl --input=../../manifest/einsteintoolkit.bib --filter=$filter";
+ `$command > $tmpfile`;
+ # get bibtex key list
+ my $keys = `$command --showkey=required-for`;
+ # generate preliminary html
+ my $html = join("", `../../bibtex/bib2xhtml -u -s unsortlist $tmpfile`);
+ unlink($tmpfile);
+ # strip html frame from list
+ $html=~s/.*(<!-- BEGIN BIB)/$1/s;
+ $html=~s/(<!-- END BIB.*-->).*/$1/s;
+ # merge key and bibtex lists
+ my $delimiter = "<!-- Authors";
+ my @html_arr = split($delimiter, $html); shift(@html_arr);
+ my @keys_arr = split("\n", $keys);
+ my @arr_of_arr = ();
+ for (my $i=0; $i<scalar(@html_arr); $i++) {
+ my $key_part2 = $keys_arr[$i];
+ $key_part2 =~ s/[^ ]* //g;
+ my $html_part = $html_arr[$i];
+ $html_part =~ s/<\/?li>//g;
+ $html_part =~ s/<\/ul>//g;
+ my %elem = ($key_part2=>$delimiter.$html_part);
+ push(@arr_of_arr, \%elem);
+ }
+ # sort
+ @arr_of_arr = sort {my (@aa, at bb); @aa = keys(%$a); @bb = keys(%$b); $aa[0] cmp $bb[0]} @arr_of_arr;
+ # output
+ print "<table>\n";
+ foreach my $elem (@arr_of_arr) {
+ my %mapp = %$elem;
+ my $key = (keys(%mapp))[0];
+ print "<tr><th align='left'>".$key."</th><td>".$mapp{$key}."</td></tr>\n";
+ }
+ print "</table>\n";
}
-# sort
- at arr_of_arr = sort {my (@aa, at bb); @aa = keys(%$a); @bb = keys(%$b); $aa[0] cmp $bb[0]} @arr_of_arr;
-# output
-print "<table>\n";
-foreach my $elem (@arr_of_arr) {
- my %mapp = %$elem;
- my $key = (keys(%mapp))[0];
- print "<tr><th align='left'>".$key."</th><td>".$mapp{$key}."</td></tr>\n";
-}
-print "</table>\n";
+
+print "<h2>Requested</h2>\n";
+&one_filter("requested_for");
+print "<h2>Suggested</h2>\n";
+&one_filter("suggested_for");
More information about the Commits
mailing list