Skip to content

Commit fc3ef16

Browse files
author
David Catmull
committed
finish parser refactor
1 parent 93212a6 commit fc3ef16

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

PBWebCommitController.m

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ - (void)commitDetailsLoaded:(NSNotification *)notification
8282

8383
// Header
8484
NSArray *headerItems = [self parseHeader:details];
85-
NSString *header = [self htmlForHeader:details withRefs:[self refsForCurrentCommit]];
85+
NSString *header = [self htmlForHeader:headerItems withRefs:[self refsForCurrentCommit]];
8686

8787
// File Stats
8888
NSMutableDictionary *stats = [self parseStats:details];
@@ -175,13 +175,14 @@ - (NSArray *)parseHeader:(NSString *)text
175175
NSArray *t=[[line substringFromIndex:r_email_e.location+2] componentsSeparatedByString:@" "];
176176
NSDate *date=[NSDate dateWithTimeIntervalSince1970:[[t objectAtIndex:0] doubleValue]];
177177

178+
NSDictionary *content = [NSDictionary dictionaryWithObjectsAndKeys:
179+
name, kAuthorKeyName,
180+
email, kAuthorKeyEmail,
181+
date, kAuthorKeyDate,
182+
nil];
178183
[result addObject:[NSDictionary dictionaryWithObjectsAndKeys:
179184
[comps objectAtIndex:0], kHeaderKeyName,
180-
[NSDictionary dictionaryWithObjectsAndKeys:
181-
name, kAuthorKeyName,
182-
email, kAuthorKeyEmail,
183-
date, kAuthorKeyDate,
184-
nil],
185+
content, kHeaderKeyContent,
185186
nil]];
186187
}
187188
}
@@ -216,12 +217,12 @@ - (NSString *)htmlForHeader:(NSArray *)header withRefs:(NSString *)badges
216217
[theDateFormatter setTimeStyle:NSDateFormatterMediumStyle];
217218
NSString *dateString=[theDateFormatter stringForObjectValue:date];
218219

219-
[auths appendString:[NSString stringWithFormat:@"<div class='user %@ clearfix'>",rol]];
220+
[auths appendString:[NSString stringWithFormat:@"<div class='user %@ clearfix'>",[item objectForKey:kHeaderKeyName]]];
220221
if([self isFeatureEnabled:@"gravatar"]){
221222
NSString *hash=[self arbitraryHashForString:email];
222223
[auths appendString:[NSString stringWithFormat:@"<img class='avatar' src='http://www.gravatar.com/avatar/%@?d=wavatar&s=30'/>",hash]];
223224
}
224-
[auths appendString:[NSString stringWithFormat:@"<p class='name'>%@ <span class='rol'>(%@)</span></p>",name,rol]];
225+
[auths appendString:[NSString stringWithFormat:@"<p class='name'>%@ <span class='rol'>(%@)</span></p>",name,[item objectForKey:kHeaderKeyName]]];
225226
[auths appendString:[NSString stringWithFormat:@"<p class='time'>%@</p></div>",dateString]];
226227
}
227228
last_mail=email;

0 commit comments

Comments
 (0)