dump html list of authors
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 26 Apr 2016 20:18:56 +0000 (22:18 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 26 Apr 2016 20:18:56 +0000 (22:18 +0200)
star2016-contributions.pl

index b11aee8..3ed9915 100755 (executable)
@@ -40,7 +40,7 @@ open(my $fh, '<:encoding(utf-8)', 'contributions/all.xml');
        close($fh);
 }
 
-warn "---xml---", dump($xml), "---/xml---\n";
+#warn "---xml---", dump($xml), "---/xml---\n";
 
 foreach my $xml ( split(/\Q<?xml\E/, $xml) ) {
 
@@ -104,6 +104,8 @@ sub l1 {
        return $l;
 }
 
+my @authors;
+
 sub abstract2doc {
        my $id = shift;
 
@@ -113,14 +115,14 @@ sub abstract2doc {
        $doc->setPageBreak( $t, position => 'before', style => 'Heading 1');
 
        foreach my $a ( @{ $abstract->{PrimaryAuthor} } ) {
-               $doc->appendParagraph(text => join(' ',
-#                      map { s/([\x{80}-\x{ff}])/enc($1)/eg && warn "# PrimaryAuthor Id: $id ",Encode::is_utf8($_), dump($_),"\n"; $_ }
-                       map { l1($a->{$_}->[0]) } qw( FirstName FamilyName )
-               ), style => 'Heading 2');
-               $doc->appendParagraph(text => join(' ',
-                       map { l1($a->{$_}->[0]) } qw( Affiliation )
-               ), style => 'Heading 3');
-               push @{ $stat->{_Affiliation}->{ $a->{Affiliation}->[0] } }, $id;
+               my $v;
+               $v->{$_} = l1($a->{$_}->[0]) foreach qw( FirstName FamilyName Affiliation Email );
+               $doc->appendParagraph(text => $v->{FirstName} . ' ' . $v->{FamilyName}, style => 'Heading 2');
+               $doc->appendParagraph(text => $v->{Affiliation}, style => 'Heading 3');
+               push @{ $stat->{_Affiliation}->{ $v->{Affiliation} } }, $id;
+
+               push @authors, $v;
+
        }
 
 #      $doc->appendParagraph(text => $abstract->{Content}->[0], style => 'Abstract');
@@ -195,6 +197,19 @@ foreach my $a ( sort keys %{ $stat->{_Affiliation} } ) {
        print $fh '"',$a,'","',dump( $stat->{_Affiliation}->{$a} ), '"', "\n";
 }
 
+
+open(my $authors_fh, '>', 'authors.html');
+foreach my $a ( sort { $a->{FamilyName} cmp $b->{FamilyName} } @authors ) {
+       print $authors_fh qq{
+<li>
+ <b>$a->{FamilyName}, $a->{FirstName}</b><br>
+ $a->{Affiliation}<br>
+ <em>$a->{Email}</em>
+</li>};
+}
+
+close $authors_fh;
+
 __DATA__
     "Symposium proposal"  => 12,
        "Symposium abstract"  => 52,