From 2ee5c6f317d6ef452b8175711980dc54d8326f1f Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Tue, 26 Apr 2016 14:30:21 +0200 Subject: [PATCH] collect abstract and then generate document --- star2016-contributions.pl | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/star2016-contributions.pl b/star2016-contributions.pl index 9ba6396..3c2869b 100755 --- a/star2016-contributions.pl +++ b/star2016-contributions.pl @@ -15,13 +15,13 @@ use OpenOffice::OODoc 2.101; my $doc = odfDocument(file => $odt_file, create => 'text'); my $stat; -my $id2nr; +my $abstracts; $doc->createStyle( "Abstract", family => 'paragraph', - parent => 'Default Style', - category => 'auto', + parent => 'Standard', +# category => 'auto', properties => { -area => 'paragraph', 'fo:text-align' => 'justify' @@ -58,7 +58,7 @@ print $xml; warn "# $id abstract = ", dump($abstract); foreach my $k (qw( ContributionType )) { - $stat->{$k}->{ $abstract->{$k}->[0] } ++; + push @{ $stat->{$k}->{ $abstract->{$k}->[0] } }, $id; } if ( my $s = $abstract->{Symposium_title} ) { @@ -66,22 +66,16 @@ print $xml; push @{ $stat->{_symposium}->{$s} }, $id; } - my $f = $abstract->{field}; - - push @{ $stat->{_symposium}->{ $f->{1}->{'content'} } }, $id if exists $f->{1}->{content}; - push @{ $stat->{_theme}->{ $f->{2}->{'content'} } }, $id if exists $f->{2}->{content}; - - $stat->{field}->{ $_ }++ foreach keys %$f; - - $id2nr->{ $id } = $nr++; + $abstracts->{ $id } = $abstract; } warn "# stat = ",dump($stat); -__END__ +sub abstract2doc { + my $id = shift; -warn "$nr"; + my $abstract = $abstracts->{$id} || die "no $id in abstracts ",dump($abstracts); my $t = $doc->appendParagraph(text => $abstract->{Title}->[0], style => 'Heading 1'); $doc->setPageBreak( $t, position => 'before', style => 'Heading 1'); @@ -105,6 +99,12 @@ warn "$nr"; $doc->appendParagraph(text => "\nID: " . $abstract->{Id}->[0], style => 'Abstract'); + + warn "# added $id to document\n"; +} + +foreach my $id ( keys %$abstracts ) { + abstract2doc($id); } warn "# stat = ",dump($stat); -- 2.20.1