[Rt-commit] r4442 - in Data-ICal: . lib/Data/ICal t
jesse at bestpractical.com
jesse at bestpractical.com
Tue Jan 24 09:51:16 EST 2006
Author: jesse
Date: Tue Jan 24 09:51:15 2006
New Revision: 4442
Modified:
Data-ICal/ (props changed)
Data-ICal/Changes
Data-ICal/META.yml
Data-ICal/lib/Data/ICal.pm
Data-ICal/lib/Data/ICal/Property.pm
Data-ICal/t/01.simplegen.t
Log:
r22898 at truegrounds: jesse | 2006-01-24 15:39:04 +0100
* 0.07 - Property quoting fixes
Modified: Data-ICal/Changes
==============================================================================
--- Data-ICal/Changes (original)
+++ Data-ICal/Changes Tue Jan 24 09:51:15 2006
@@ -1,5 +1,6 @@
Revision history for Data-ICal
* Doc patches from MARKSTOS
+ * Proper quoting in properties, from MARKSTOS
0.05 Thu Oct 6 20:56:05 EDT 2005
* Fixed a signature file
Modified: Data-ICal/META.yml
==============================================================================
--- Data-ICal/META.yml (original)
+++ Data-ICal/META.yml Tue Jan 24 09:51:15 2006
@@ -1,18 +1,19 @@
-name: Data-ICal
-version: 0.05
abstract: Generates iCalendar (RFC 2445) calendar files
-author: Jesse Vincent <jesse at bestpractical.com>
-license: perl
-distribution_type: module
+author: 'Jesse Vincent <jesse at bestpractical.com>'
build_requires:
+ Test::LongString: 0
Test::More: 0
- Test::Warn: 0
Test::NoWarnings: 0
- Test::LongString: 0
-requires:
- Class::Accessor: 0
- Text::vFile::asData: 0
+ Test::Warn: 0
+distribution_type: module
+generated_by: Module::Install version 0.52
+license: perl
+name: Data-ICal
no_index:
directory:
- inc
-generated_by: Module::Install version 0.36
+ - t
+requires:
+ Class::Accessor: 0
+ Text::vFile::asData: 0
+version: 0.07
Modified: Data-ICal/lib/Data/ICal.pm
==============================================================================
--- Data-ICal/lib/Data/ICal.pm (original)
+++ Data-ICal/lib/Data/ICal.pm Tue Jan 24 09:51:15 2006
@@ -6,7 +6,7 @@
use Text::vFile::asData;
-our $VERSION = '0.05';
+our $VERSION = '0.07';
use Carp;
Modified: Data-ICal/lib/Data/ICal/Property.pm
==============================================================================
--- Data-ICal/lib/Data/ICal/Property.pm (original)
+++ Data-ICal/lib/Data/ICal/Property.pm Tue Jan 24 09:51:15 2006
@@ -7,6 +7,8 @@
use Carp;
+our $VERSION = '0.06';
+
=head1 NAME
Data::ICal::Property - Represents a property on an entry in an iCalendar file
@@ -75,7 +77,7 @@
my $self = shift;
my $string = uc( $self->key )
. $self->_parameters_as_string . ":"
- . $self->value . "\n";
+ . $self->_value_as_string . "\n";
# Assumption: the only place in an iCalendar that needs folding are property
# lines
@@ -84,6 +86,33 @@
=begin private
+=head2 _value_as_string
+
+Returns the property's value as a string.
+
+Values are quoted according the ICal spec:
+L<http://www.kanzaki.com/docs/ical/text.html>.
+
+=end private
+
+=cut
+
+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;
+
+ return $value;
+
+}
+
+=begin private
+
=head2 _parameters_as_string
Returns the property's parameters as a string. Properties are sorted alphabetically
Modified: Data-ICal/t/01.simplegen.t
==============================================================================
--- Data-ICal/t/01.simplegen.t (original)
+++ Data-ICal/t/01.simplegen.t Tue Jan 24 09:51:15 2006
@@ -62,7 +62,7 @@
BEGIN:VTODO
COMMENT:a first comment
COMMENT:a second comment
-SUMMARY:This one trumps number two, even though weird capitalization!
+SUMMARY:This one trumps number two\\, even though weird capitalization!
URL:http://example.com/todo1
END:VTODO
END:VCALENDAR
@@ -80,7 +80,7 @@
$event->add_properties(
summary => 'Awesome party',
- description => 'at my place!',
+ description => 'at my \ place,\nOn 5th St.;',
);
ok($s->add_entry($event));
@@ -93,11 +93,11 @@
BEGIN:VTODO
COMMENT:a first comment
COMMENT:a second comment
-SUMMARY:This one trumps number two, even though weird capitalization!
+SUMMARY:This one trumps number two\\, even though weird capitalization!
URL:http://example.com/todo1
END:VTODO
BEGIN:VEVENT
-DESCRIPTION:at my place!
+DESCRIPTION:at my \\ place\\,\\nOn 5th St.\\;
SUMMARY:Awesome party
END:VEVENT
END:VCALENDAR
More information about the Rt-commit
mailing list