applied changes from b0f4711fa3917d9ca82a918807fe75046c131ee1

through 2b628a62ac49757d2bbeda1275fc38d69079752a

applied changes from e5a4a8243c282c12538ab38c9b5c23722be35e99
             through d9bec826cdc8df69ea27563722cd678c85ebcf20

Monotone-Parent: eb1f58bb7bd3454ffc857750264fae0b27b86d32
Monotone-Revision: dac752317ac0c81975ef28320e87acabbe394823

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2011-11-14T16:26:04
maint-2.0.2
Francis Lachapelle 2011-11-14 16:26:04 +00:00
parent 63e0b0e116
commit be0053879e
4 changed files with 56 additions and 43 deletions

View File

@ -72,41 +72,19 @@
}
[rendering appendString: [tag uppercaseString]];
/* parameters */
attributes = [anElement attributes];
keys = [[attributes allKeys] objectEnumerator];
while ((key = [keys nextObject]))
if ([attributes count])
{
NSString *s;
int i, c;
renderedAttrs = [[attributes objectForKey: key] renderedForCards];
c = [renderedAttrs count];
if (c > 0)
{
[rendering appendFormat: @";%@=", [key uppercaseString]];
for (i = 0; i < c; i++)
{
s = [renderedAttrs objectAtIndex: i];
/* We MUST quote attribute values that have a ":" in them
and that not already quoted */
if ([s length] > 2 && [s rangeOfString: @":"].length &&
[s characterAtIndex: 0] != '"' && ![s hasSuffix: @"\""])
s = [NSString stringWithFormat: @"\"%@\"", s];
[rendering appendFormat: @"%@", s];
if (i+1 < c)
[rendering appendString: @","];
}
}
[rendering appendString: @";"];
[attributes versitRenderInString: rendering asAttributes: YES];
}
/* values */
values = [anElement values];
if ([values count] > 0)
[rendering appendFormat: @":%@",
[[values renderedForCards] componentsJoinedByString: @";"]];
[rendering appendString: @":"];
[values versitRenderInString: rendering asAttributes: NO];
if ([rendering length] > 0)
[rendering appendString: @"\r\n"];

View File

@ -1,3 +1,37 @@
2011-11-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalTrigger.m (-setValue:, value): removed useless accessors.
* iCalAttachment.m (-setValue:, value): removed useless accessors.
* iCalRecurrenceRule.m (-setRrule): now makes use of the existing
parsing algorithm and get the values from the parsed element.
* iCalEntityObject.m (-setCategories:): now take an array as
parameter.
* NSString+NGCards.m (-vCardSubvalues): new method adapted to the
new CardElement data structure, replaces
"vCardSubvaluesWithSeparator:", since we now know how to properly
separate or escape elements.
* CardElement.m (-init): "values" in now an NSMutableDictionary.
(-setValues:, -values): new primitive accessors;
(-setValues:atIndex:forKey:, -setSingleValue:atIndex:forKey:)
(setSingleValue:forKey:): new helper setters.
(-flattenedValueAtIndex:forKey:, -flattenedValues:forKey:): new
"flattened" helper getters. "Flattening" meaning here that the
first and/or second level array are merged with "," and ";", to
support clients that badly escape(d) their output for fields
taking only one value or a specific set of values.
(-valuesForKey:,-valuesAtIndex:forKey:): new helper getters
2011-11-09 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* NSString+NGCards.m (-escapedForCards): restored the escaping of
commas, since they might be used in fields such as
COMMENT/DESCRIPTION (iCalendar) or NOTE (vCards)
2011-09-20 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalToDo.m (-setCompleted:): (hack) when invoked with a nil

View File

@ -157,8 +157,8 @@
string = [self stringByReplacingString: @"\\"
withString: @"\\\\"];
// string = [string stringByReplacingString: @","
// withString: @"\\,"];
string = [string stringByReplacingString: @","
withString: @"\\,"];
// string = [string stringByReplacingString: @":"
// withString: @"\\:"];
string = [string stringByReplacingString: @";"

View File

@ -72,54 +72,55 @@
/* accessors */
- (void) setUid: (NSString *) _uid
- (void) setUid: (NSString *) _value
{
[[self uniqueChildWithTag: @"uid"] setValue: 0 to: _uid];
[[self uniqueChildWithTag: @"uid"] setSingleValue: _value forKey: @""];
}
- (NSString *) uid
{
return [[self uniqueChildWithTag: @"uid"] value: 0];
return [[self uniqueChildWithTag: @"uid"] flattenedValuesForKey: @""];
}
- (void) setSummary: (NSString *) _value
{
[[self uniqueChildWithTag: @"summary"] setValue: 0 to: _value];
[[self uniqueChildWithTag: @"summary"] setSingleValue: _value forKey: @""];
}
- (NSString *) summary
{
return [[self uniqueChildWithTag: @"summary"] value: 0];
return [[self uniqueChildWithTag: @"summary"] flattenedValuesForKey: @""];
}
- (void) setLocation: (NSString *) _value
{
[[self uniqueChildWithTag: @"location"] setValue: 0 to: _value];
[[self uniqueChildWithTag: @"location"] setSingleValue: _value forKey: @""];
}
- (NSString *) location
{
return [[self uniqueChildWithTag: @"location"] value: 0];
return [[self uniqueChildWithTag: @"location"] flattenedValuesForKey: @""];
}
#warning the "comment" accessors are actually "description" accessors, the "comment" ones are missing
- (void) setComment: (NSString *) _value
{
[[self uniqueChildWithTag: @"description"] setValue: 0 to: _value];
[[self uniqueChildWithTag: @"description"] setSingleValue: _value forKey: @""];
}
- (NSString *) comment
{
return [[self uniqueChildWithTag: @"description"] value: 0];
return [[self uniqueChildWithTag: @"description"] flattenedValuesForKey: @""];
}
- (void) setAccessClass: (NSString *) _value
{
[[self uniqueChildWithTag: @"class"] setValue: 0 to: _value];
[[self uniqueChildWithTag: @"class"] setSingleValue: _value forKey: @""];
}
- (NSString *) accessClass
{
return [[self uniqueChildWithTag: @"class"] value: 0];
return [[self uniqueChildWithTag: @"class"] flattenedValuesForKey: @""];
}
- (iCalAccessClass) symbolicAccessClass