User:PabloDuboue/Area Chairs Script
< User:PabloDuboue
Jump to navigation
Jump to search
Revision as of 22:52, 3 July 2015 by PabloDuboue (talk | contribs) (Created page with "<pre> #!/usr/bin/perl # I, Pablo Duboue, dedicate this to the Public Domain. use strict; my@rows; my$prev; while(<STDIN>){ chomp; next if($_ eq $prev); $prev =...")
#!/usr/bin/perl # I, Pablo Duboue, dedicate this to the Public Domain. use strict; my@rows; my$prev; while(<STDIN>){ chomp; next if($_ eq $prev); $prev = $_; push@rows, [ split(/\t/,$_) ]; }; my @header = @{shift @rows}; my%idx=(); foreach my$i(0..$#header){ $idx{$header[$i]}=$i; print "$i $header[$i]\n" }; foreach my$r(@rows){ my@row = @{$r}; print "== [" . $row[1] . " " . $row[0] ."] ==\n\n"; #print $row[0]."\n".$row[1]."\n"; print '{|class=wikitable border="1" ! Area !! Chair(s) !! Submissions (long, short) |- '; print "| General Chair || ".$row[$idx{"Answer.general_chair"}]." (".$row[$idx{"Answer.affiliation_general_chair"}].") ||\n"; print "|-\n"; print "| Program Chairs || "; foreach my$k(1..2){ if($k == 2){ print ", "; } print $row[$idx{"Answer.program_chair_$k"}]." (".$row[$idx{"Answer.affiliation_program_chair_$k"}].")"; }; print " || \n"; $prev = 0; foreach my$k(0..39){ if($row[$idx{"Answer.area_".$k}] eq $prev){ print ", " . $row[$idx{"Answer.name_".$k}]." (".$row[$idx{"Answer.affiliation_".$k}].")"; }else{ if($prev){ print " ||\n"; } print "|-\n"; print "| " . $row[$idx{"Answer.area_".$k}]." || ".$row[$idx{"Answer.name_".$k}]." (".$row[$idx{"Answer.affiliation_".$k}].")"; } $prev = $row[$idx{"Answer.area_".$k}]; } print " ||\n"; print "| * || * || \n"; print "|}\n"; print "\n* No information is found for the area chair for each specific area. Below is the list of all area chairs for " . $row[0] . ":\n\n"; foreach my$k(0..39){ print $row[$idx{"Answer.name_".$k}]." (".$row[$idx{"Answer.affiliation_".$k}]."), " } print "\n\n\n" . $row[$idx{"Answer.comment"}] . "\n"; }