mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Tidy up the commit message to ensure it won't break the diff view.
Renamed the GLFileView's +parseHTML into something more meaningful regarding what it actually does. Also, the method might need to be moved to somewhere else...
This commit is contained in:
+1
-1
@@ -31,7 +31,7 @@
|
||||
- (void)showFile;
|
||||
- (void)didLoad;
|
||||
- (NSString *)parseBlame:(NSString *)txt;
|
||||
+ (NSString *)parseHTML:(NSString *)txt;
|
||||
+ (NSString *)cleanupHTML:(NSString *)txt;
|
||||
+ (NSString *)parseDiff:(NSString *)txt;
|
||||
+ (NSString *)parseDiffTree:(NSString *)txt withStats:(NSMutableDictionary *)stats;
|
||||
+ (NSString *)getFileName:(NSString *)line;
|
||||
|
||||
+11
-8
@@ -110,7 +110,7 @@
|
||||
if(startFile==@"fileview"){
|
||||
fileTxt=[file textContents:&theError];
|
||||
if(!theError)
|
||||
fileTxt=[GLFileView parseHTML:fileTxt];
|
||||
fileTxt=[GLFileView cleanupHTML:fileTxt];
|
||||
}else if(startFile==@"blame"){
|
||||
fileTxt=[file blame:&theError];
|
||||
if(!theError)
|
||||
@@ -240,13 +240,16 @@
|
||||
[super closeView];
|
||||
}
|
||||
|
||||
+ (NSString *) parseHTML:(NSString *)txt
|
||||
+ (NSString *) cleanupHTML:(NSString *)txt
|
||||
{
|
||||
txt=[txt stringByReplacingOccurrencesOfString:@"&" withString:@"&"];
|
||||
txt=[txt stringByReplacingOccurrencesOfString:@"<" withString:@"<"];
|
||||
txt=[txt stringByReplacingOccurrencesOfString:@">" withString:@">"];
|
||||
NSMutableString *newTxt = [NSMutableString stringWithString:txt];
|
||||
[newTxt replaceOccurrencesOfString:@"&" withString:@"&" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])];
|
||||
[newTxt replaceOccurrencesOfString:@"<" withString:@"<" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])];
|
||||
[newTxt replaceOccurrencesOfString:@">" withString:@">" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])];
|
||||
[newTxt replaceOccurrencesOfString:@"\"" withString:@""" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])];
|
||||
[newTxt replaceOccurrencesOfString:@"'" withString:@"'" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])];
|
||||
|
||||
return txt;
|
||||
return newTxt;
|
||||
}
|
||||
|
||||
+ (NSString *)parseDiffTree:(NSString *)txt withStats:(NSMutableDictionary *)stats
|
||||
@@ -296,7 +299,7 @@
|
||||
|
||||
+ (NSString *)parseDiff:(NSString *)txt
|
||||
{
|
||||
txt=[self parseHTML:txt];
|
||||
txt=[self cleanupHTML:txt];
|
||||
|
||||
NSMutableString *res=[NSMutableString string];
|
||||
NSScanner *scan=[NSScanner scannerWithString:txt];
|
||||
@@ -504,7 +507,7 @@
|
||||
|
||||
- (NSString *) parseBlame:(NSString *)txt
|
||||
{
|
||||
txt=[GLFileView parseHTML:txt];
|
||||
txt=[GLFileView cleanupHTML:txt];
|
||||
|
||||
NSArray *lines = [txt componentsSeparatedByString:@"\n"];
|
||||
NSString *line;
|
||||
|
||||
@@ -167,7 +167,8 @@
|
||||
}
|
||||
}else{
|
||||
if (subj) {
|
||||
[subject appendString:[NSString stringWithFormat:@"%@<br/>",[line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]]];
|
||||
NSString *trimmedLine = [line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
[subject appendString:[NSString stringWithFormat:@"%@<br/>",[GLFileView cleanupHTML:trimmedLine]]];
|
||||
}else{
|
||||
NSArray *comps=[line componentsSeparatedByString:@" "];
|
||||
if([comps count]==2){
|
||||
|
||||
Reference in New Issue
Block a user