[Rt-commit] r4471 - in Data-ICal: . lib/Data/ICal

glasser at bestpractical.com glasser at bestpractical.com
Fri Feb 3 13:56:21 EST 2006


Author: glasser
Date: Fri Feb  3 13:56:21 2006
New Revision: 4471

Modified:
   Data-ICal/   (props changed)
   Data-ICal/META.yml
   Data-ICal/lib/Data/ICal/Property.pm
   Data-ICal/t/05.prop-params.t
   Data-ICal/t/09.mime.t
   Data-ICal/t/10.mime-vcal10.t

Log:
 r53610 at david-glassers-powerbook-g4-15:  glasser | 2006-02-03 13:55:40 -0500
 Oops, the former line folding algorithm could loop. =-based and space-based really need separate loops.


Modified: Data-ICal/META.yml
==============================================================================
--- Data-ICal/META.yml	(original)
+++ Data-ICal/META.yml	Fri Feb  3 13:56:21 2006
@@ -13,6 +13,7 @@
   Class::Accessor: 0
   Text::vFile::asData: 0
   MIME::QuotedPrint: 0
+  Class::ReturnValue: 0
 no_index:
   directory:
     - inc

Modified: Data-ICal/lib/Data/ICal/Property.pm
==============================================================================
--- Data-ICal/lib/Data/ICal/Property.pm	(original)
+++ Data-ICal/lib/Data/ICal/Property.pm	Fri Feb  3 13:56:21 2006
@@ -183,8 +183,8 @@
 
 Returns the property's value as a string.  
 
-Values are quoted according the ICal spec:
-L<http://www.kanzaki.com/docs/ical/text.html>.
+Values are quoted according the iCal spec, unless 
+this is in vCal 1.0 mode.
 
 =end private
 
@@ -193,12 +193,14 @@
 sub _value_as_string {
     my $self = shift;
     my $value = $self->value();
-
-    $value =~ s/\\/\\/gs;
-    $value =~ s/\Q;/\\;/gs;
-    $value =~ s/,/\\,/gs;
-    $value =~ s/\n/\\n/gs;
-    $value =~ s/\\N/\\N/gs;
+    
+    unless ($self->vcal10) {
+        $value =~ s/\\/\\/gs;
+        $value =~ s/\Q;/\\;/gs;
+        $value =~ s/,/\\,/gs;
+        $value =~ s/\n/\\n/gs;
+        $value =~ s/\\N/\\N/gs;
+    }
 
     return $value;
 
@@ -280,17 +282,19 @@
     my $use_equals = $self->vcal10 && 
         uc $self->parameters->{'ENCODING'} eq 'QUOTED-PRINTABLE';
 
-    my $replacement = $use_equals ? "=\n" : "\n ";
-
-    # We can't just use a s//g, because we need to include the added space and
+    # We can't just use a s//g, because we need to include the added space/= and
     # first character of the next line in the count for the next line.
-    #
-    # Note that while it tries to break up lines of 76 chars, it actually inserts
-    # the split after the 74th, not 75th, char, since otherwise it would be replacing
-    # the last char with an = in $use_equals mode which would not decrease its length.
-    while ( $string =~ /(.{76})/ ) {
-        $string =~ s/(.{74})(.)/$1$replacement$2/;
+
+    if ($use_equals) {
+        while ( $string =~ /.{75}[^\n=]/ ) {
+            $string =~ s/(.{75})([^\n=])/$1=\n$2/;
+        }
+    } else {
+        while ( $string =~ /(.{76})/ ) {
+            $string =~ s/(.{75})(.)/$1\n $2/;
+        }
     }
+
     return $string;
 }
 

Modified: Data-ICal/t/05.prop-params.t
==============================================================================
--- Data-ICal/t/05.prop-params.t	(original)
+++ Data-ICal/t/05.prop-params.t	Fri Feb  3 13:56:21 2006
@@ -19,8 +19,8 @@
 
 is_string($todo->as_string, <<'END_VCAL', "Got the right output");
 BEGIN:VTODO
-ATTENDEE;MEMBER="MAILTO:projectA at host.com","MAILTO:projectB at host.com":MAIL
- TO:janedoe at host.com
+ATTENDEE;MEMBER="MAILTO:projectA at host.com","MAILTO:projectB at host.com":MAILT
+ O:janedoe at host.com
 SUMMARY;LANGUAGE=en-US;VALUE=TEXT:Sum it up.
 END:VTODO
 END_VCAL

Modified: Data-ICal/t/09.mime.t
==============================================================================
--- Data-ICal/t/09.mime.t	(original)
+++ Data-ICal/t/09.mime.t	Fri Feb  3 13:56:21 2006
@@ -12,8 +12,8 @@
 PRODID:Data::ICal 0.07
 VERSION:2.0
 BEGIN:VTODO
-DESCRIPTION;ENCODING=QUOTED-PRINTABLE:interesting things         =0D=0AYea
- h!!=3D cbla=0D=0A=0D=0A=0D=0AGo team syncml!=0D=0A=0D=0A=0D=0A
+DESCRIPTION;ENCODING=QUOTED-PRINTABLE:interesting things         =0D=0AYeah
+ !!=3D cbla=0D=0A=0D=0A=0D=0AGo team syncml!=0D=0A=0D=0A=0D=0A
 END:VTODO
 END:VCALENDAR
 END_VCAL

Modified: Data-ICal/t/10.mime-vcal10.t
==============================================================================
--- Data-ICal/t/10.mime-vcal10.t	(original)
+++ Data-ICal/t/10.mime-vcal10.t	Fri Feb  3 13:56:21 2006
@@ -12,8 +12,8 @@
 PRODID:Data::ICal 0.07
 VERSION:1.0
 BEGIN:VTODO
-DESCRIPTION;ENCODING=QUOTED-PRINTABLE:interesting things         =0D=0AYea=
-h!!=3D cbla=0D=0A=0D=0A=0D=0AGo team syncml!=0D=0A=0D=0A=0D=0A
+DESCRIPTION;ENCODING=QUOTED-PRINTABLE:interesting things         =0D=0AYeah=
+!!=3D cbla=0D=0A=0D=0A=0D=0AGo team syncml!=0D=0A=0D=0A=0D=0A
 END:VTODO
 END:VCALENDAR
 END_VCAL


More information about the Rt-commit mailing list