summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/events2md.pl32
1 files changed, 16 insertions, 16 deletions
diff --git a/bin/events2md.pl b/bin/events2md.pl
index 8618b24..71111c3 100755
--- a/bin/events2md.pl
+++ b/bin/events2md.pl
@@ -181,12 +181,11 @@ sub print_event
my $description = unescape( $event->{DESCRIPTION} );
$description =~ s/\n\n[Pp]ris:\s*((?!\n).+)\s*\z//m;
my $price = $1;
+ my @attendees;
if ( $event->{ATTENDEE} ) {
- $description .= " \nMed ";
- $description .= join ' og ',
- map { $_->{CN} || $_->{value} =~ s/^mailto://r }
- @{ $event->{ATTENDEE} };
- $description .= '.';
+ for ( @{ $event->{ATTENDEE} } ) {
+ push @attendees, $_->{'CN'} || $_->{value} =~ s/^mailto://r;
+ }
}
my $location = unescape( $event->{LOCATION} );
my $time_begin = ucfirst( $event->{DTSTART}->strftime('%A') );
@@ -203,22 +202,23 @@ sub print_event
}
}
- $_ = <<"STRING";
-### $time_begin. $summary
-$description
-
-STRING
- $_ .= "**Mødested:** $location \n"
+ $_ = "### $time_begin.";
+ $_ .= " $summary"
+ if $summary;
+ $_ .= "\n$description";
+ $_ .= " \nMed " . join( ' og ', @attendees ) . '.'
+ if @attendees;
+ $_ .= " \n**Mødested:** $location"
if $location;
- $_ .= "**Tid:** ${time_begin}-${time_end}. \n"
+ $_ .= " \n**Tid:** ${time_begin}-${time_end}."
if $time_begin and $time_end;
- $_ .= "**Pris:** $price \n"
+ $_ .= " \n**Pris:** $price"
if $price;
- $_ .= "[Køb billet på Billetto]($attachments{'billetto.dk'}[0]) \n"
+ $_ .= " \n[Køb billet på Billetto]($attachments{'billetto.dk'}[0])"
if $attachments{'billetto.dk'};
- $_ .= "[Læs mere her]($attachments{'byvandring.nu'}[0]) \n"
+ $_ .= " \n[Læs mere her]($attachments{'byvandring.nu'}[0])"
if $attachments{'byvandring.nu'};
- $_ .= "\n---\n\n";
+ $_ .= "\n\n---\n\n";
if ($path) {
$path->append_utf8($_);