[Commits] [svn:einsteintoolkit] www/ (Rev. 408)

knarf at cct.lsu.edu knarf at cct.lsu.edu
Mon Nov 15 16:57:02 CST 2010


User: knarf
Date: 2010/11/15 04:57 PM

Added:
 /info/citing/
  parse_citations.pl

Modified:
 /info/citing/
  index.php

Log:
 update script

Directory Changes:

Directory: /svn:executable/
===========================

   + *

File Changes:

Directory: /info/citing/
========================

File [modified]: index.php
Delta lines: +1 -1
===================================================================
--- info/citing/index.php	2010-11-15 21:05:46 UTC (rev 407)
+++ info/citing/index.php	2010-11-15 22:57:02 UTC (rev 408)
@@ -41,7 +41,7 @@
 
 
 <?php
-exec('../../bibtex/bib2xhtml -u -s unsortlist ../../manifest/einsteintoolkit.bib | perl -e \'my $a=join("",<stdin>); $a=~s/.*(<!-- BEGIN BIB)/$1/s; $a=~s/(<!-- END BIB.*-->).*/$1/s; print $a;\'', $output);
+exec('./parse_citations.pl', $output);
 foreach ($output as $line) {
   echo $line."\n";
 }

File [added]: parse_citations.pl
Delta lines: +38 -0
===================================================================
--- info/citing/parse_citations.pl	                        (rev 0)
+++ info/citing/parse_citations.pl	2010-11-15 22:57:02 UTC (rev 408)
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+use strict;
+use Data::Dumper;
+
+# create bib file
+my $command = "../../../tools/trunk/bibtex/parse_bibtex.pl --input ../../manifest/einsteintoolkit.bib --filter=required-for";
+`$command > citations.bib`;
+# get bibtex key list
+my $keys = `$command --showkey=required-for`;
+# generate preliminary html
+my $html = join("", `bib2xhtml -u -s unsortlist citations.bib`);
+# 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
+ 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";



Property changes on: info/citing/parse_citations.pl
___________________________________________________________________



More information about the Commits mailing list