Card view: don't escape <br>'s in note field

pull/58/head
Francis Lachapelle 2014-10-05 00:30:27 -04:00
parent f353b6d1c0
commit a0317046ba
2 changed files with 17 additions and 3 deletions

3
NEWS
View File

@ -2,7 +2,8 @@
-------------------
Bug fixes
- fix freebusy lookup with "Show time as busy" (#2930)
- fixed freebusy lookup with "Show time as busy" (#2930)
- don't escape <br>'s in a card's note field
2.2.9a (2014-09-29)
-------------------

View File

@ -67,15 +67,18 @@
- (NSString *) _cardStringWithLabel: (NSString *) label
value: (NSString *) value
byEscapingHTMLString: (BOOL) escapeHTML
asLinkScheme: (NSString *) scheme
withLinkAttributes: (NSString *) attrs
{
NSMutableString *cardString;
cardString = [NSMutableString stringWithCapacity: 80];
value = [[value stringByReplacingString: @"\r" withString: @""] stringByEscapingHTMLString];
value = [value stringByReplacingString: @"\r" withString: @""];
if ([value length] > 0)
{
if (escapeHTML)
value = [value stringByEscapingHTMLString];
if ([scheme length] > 0)
value = [NSString stringWithFormat: @"<a href=\"%@%@\" %@>%@</a>", scheme, value, attrs, value];
@ -94,6 +97,7 @@
{
return [self _cardStringWithLabel: label
value: value
byEscapingHTMLString: YES
asLinkScheme: nil
withLinkAttributes: nil];
}
@ -104,6 +108,7 @@
{
return [self _cardStringWithLabel: label
value: value
byEscapingHTMLString: YES
asLinkScheme: scheme
withLinkAttributes: nil];
}
@ -144,6 +149,7 @@
return [self _cardStringWithLabel: @"Email:"
value: email
byEscapingHTMLString: YES
asLinkScheme: @"mailto:"
withLinkAttributes: attrs];
}
@ -182,6 +188,7 @@
[secondaryEmails addObject: [self _cardStringWithLabel: nil
value: email
byEscapingHTMLString: YES
asLinkScheme: @"mailto:"
withLinkAttributes: attrs]];
}
@ -365,6 +372,7 @@
return [self _cardStringWithLabel: nil
value: data
byEscapingHTMLString: YES
asLinkScheme: schema
withLinkAttributes: @"target=\"_blank\""];
}
@ -591,13 +599,18 @@
note = [card note];
if (note)
{
note = [note stringByEscapingHTMLString];
note = [note stringByReplacingString: @"\r\n"
withString: @"<br />"];
note = [note stringByReplacingString: @"\n"
withString: @"<br />"];
}
return [self _cardStringWithLabel: @"Note:" value: note];
return [self _cardStringWithLabel: @"Note:"
value: note
byEscapingHTMLString: NO
asLinkScheme: nil
withLinkAttributes: nil];
}
/* hrefs */