File: cal2text

package info (click to toggle)
emacspeak 53.0%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 33,768 kB
  • sloc: lisp: 56,393; xml: 52,463; tcl: 1,333; cpp: 1,168; sh: 859; makefile: 739; python: 547; perl: 509; javascript: 191; ansic: 82
file content (51 lines) | stat: -rwxr-xr-x 1,179 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/perl -w
#$Id$
#Display Calendar invites in a readable form.
use strict;
my  %fields =qw(
                DTSTART  Start
                DTEND End
                DTSTART;TZID="Eastern" StartEastern
                DTEND;TZID="Eastern" EndEastern
DTSTART;TZID="Pacific" StartPacific
                DTEND;TZID="Pacific" EndPacific
DTSTART;TZID="Central" StartCentral
                DTEND;TZID="Central" EndCentral
                DESCRIPTION Description
                SUMMARY Summary
                LOCATION Location
               );
my $marker ='^BEGIN:VEVENT';
my $start;
while (<> ) {
  last if (m/$marker/ ) ;
    
  
}

print "\n\n";
my @lines;
my $i=0;
while (<>) {
  chomp;
  if (/^\s/) {                  #continuation line
    s/^\s+//g;
    $lines[$i-1] .= $_;
  } else {
    $lines[$i++]=$_;
  }
}
#Process lines 
foreach (@lines) {
  my ($f, $v) =split(':');
  my $key=$fields{$f};
  print "$key:\t$v\n" if defined($key);
}
#Process attendee list
print "\nAttendees\n\n";
foreach (@lines) {
  my ($f, $v) =split (':',$_,2);
  next unless ($f =~ m/ATTENDEE/);
  $f =~ s/^ATTENDEE;//g;
  print $v,"\n";         # "\t", join("\t", split(';', $f)),"\n";
}