Commit 5c0d397 1 parent 70f3c91 commit 5c0d397 Copy full SHA for 5c0d397
File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -104,9 +104,13 @@ @implementation MLNAttributionInfo
104
104
[attributedString removeAttribute: NSStrokeWidthAttributeName range: range];
105
105
}
106
106
107
- // Omit whitespace-only strings.
107
+ // Clean up strings by stripping punctuation and whitespace (often present for the web).
108
+ NSMutableCharacterSet *charset = [NSMutableCharacterSet whitespaceAndNewlineCharacterSet ];
109
+ [charset formUnionWithCharacterSet: [NSCharacterSet punctuationCharacterSet ]];
108
110
NSAttributedString *title = [[attributedString attributedSubstringFromRange: range]
109
- mgl_attributedStringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet ]];
111
+ mgl_attributedStringByTrimmingCharactersInSet: charset];
112
+
113
+ // Omit strings that are empty after cleaning.
110
114
if (!title.length ) {
111
115
return ;
112
116
}
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ - (void)tearDown {
20
20
- (void )testParsing {
21
21
static NSString * const htmlStrings[] = {
22
22
@" <a href=\" https://www.mapbox.com/about/maps/\" target=\" _blank\" >© Mapbox</a> "
23
- @" <a href=\" http://www.openstreetmap.org/about/\" target=\" _blank\" >©️ OpenStreetMap</a> "
23
+ @" <a href=\" http://www.openstreetmap.org/about/\" target=\" _blank\" >©️ OpenStreetMap</a>, "
24
24
@" CC BY-SA "
25
25
@" <a class=\" mapbox-improve-map\" href=\" https://apps.mapbox.com/feedback/\" target=\" _blank\" >Improve this map</a>" ,
26
26
};
You can’t perform that action at this time.
0 commit comments