From: Christiaan H. <ho...@us...> - 2005-08-30 16:06:26
|
Update of /cvsroot/bibdesk/bibdesk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17255 Modified Files: Tag: BR_1x BibTypeManager.m BDSKFormatParser.m Log Message: Allow user local file types to be treated as Local-Url. Index: BibTypeManager.m =================================================================== RCS file: /cvsroot/bibdesk/bibdesk/BibTypeManager.m,v retrieving revision 1.38.2.6 retrieving revision 1.38.2.7 diff -C2 -d -r1.38.2.6 -r1.38.2.7 *** BibTypeManager.m 29 Aug 2005 15:00:20 -0000 1.38.2.6 --- BibTypeManager.m 30 Aug 2005 16:06:18 -0000 1.38.2.7 *************** *** 257,261 **** return invalidCiteKeyCharSet; } ! if([fieldName isEqualToString:BDSKLocalUrlString]){ return invalidLocalUrlCharSet; } --- 257,261 ---- return invalidCiteKeyCharSet; } ! if([[[OFPreferenceWrapper sharedPreferenceWrapper] stringArrayForKey:BDSKLocalFileFieldsKey] containsObject:BDSKLocalUrlString]){ return invalidLocalUrlCharSet; } *************** *** 267,271 **** return strictInvalidCiteKeyCharSet; } ! if([fieldName isEqualToString:BDSKLocalUrlString]){ return strictInvalidLocalUrlCharSet; } --- 267,271 ---- return strictInvalidCiteKeyCharSet; } ! if([[[OFPreferenceWrapper sharedPreferenceWrapper] stringArrayForKey:BDSKLocalFileFieldsKey] containsObject:BDSKLocalUrlString]){ return strictInvalidLocalUrlCharSet; } Index: BDSKFormatParser.m =================================================================== RCS file: /cvsroot/bibdesk/bibdesk/BDSKFormatParser.m,v retrieving revision 1.7.2.6 retrieving revision 1.7.2.7 diff -C2 -d -r1.7.2.6 -r1.7.2.7 *** BDSKFormatParser.m 17 Aug 2005 08:40:18 -0000 1.7.2.6 --- BDSKFormatParser.m 30 Aug 2005 16:06:18 -0000 1.7.2.7 *************** *** 84,87 **** --- 84,89 ---- NSScanner *wordScanner; NSCharacterSet *slashCharSet = [NSCharacterSet characterSetWithCharactersInString:@"/"]; + NSArray *localFileFields = [[OFPreferenceWrapper sharedPreferenceWrapper] stringArrayForkey:BDSKLocalFileFieldsKey]; + BOOL isLocalFile = [localFileFields containsObject:fieldName]; // seed for random letters or characters *************** *** 138,142 **** } string = [self stringByStrictlySanitizingString:[[pub authorAtIndex:i] lastName] forField:fieldName inFileType:[pub fileType]]; ! if ([fieldName isEqualToString:BDSKLocalUrlString]) { string = [string stringByReplacingCharactersInSet:slashCharSet withString:@"-"]; } --- 140,144 ---- } string = [self stringByStrictlySanitizingString:[[pub authorAtIndex:i] lastName] forField:fieldName inFileType:[pub fileType]]; ! if (isLocalFile) { string = [string stringByReplacingCharactersInSet:slashCharSet withString:@"-"]; } *************** *** 197,201 **** string = lastName; } ! if ([fieldName isEqualToString:BDSKLocalUrlString]) { string = [string stringByReplacingCharactersInSet:slashCharSet withString:@"-"]; } --- 199,203 ---- string = lastName; } ! if (isLocalFile) { string = [string stringByReplacingCharactersInSet:slashCharSet withString:@"-"]; } *************** *** 214,218 **** } string = [self stringByStrictlySanitizingString:string forField:fieldName inFileType:[pub fileType]]; ! if ([fieldName isEqualToString:BDSKLocalUrlString]) { string = [string stringByReplacingCharactersInSet:slashCharSet withString:@"-"]; } --- 216,220 ---- } string = [self stringByStrictlySanitizingString:string forField:fieldName inFileType:[pub fileType]]; ! if (isLocalFile) { string = [string stringByReplacingCharactersInSet:slashCharSet withString:@"-"]; } *************** *** 252,256 **** if (i > 0) [parsedStr appendString:[self stringByStrictlySanitizingString:@" " forField:fieldName inFileType:[pub fileType]]]; string = [self stringByStrictlySanitizingString:[arr objectAtIndex:i] forField:fieldName inFileType:[pub fileType]]; ! if ([fieldName isEqualToString:BDSKLocalUrlString]) { string = [string stringByReplacingCharactersInSet:slashCharSet withString:@"-"]; } --- 254,258 ---- if (i > 0) [parsedStr appendString:[self stringByStrictlySanitizingString:@" " forField:fieldName inFileType:[pub fileType]]]; string = [self stringByStrictlySanitizingString:[arr objectAtIndex:i] forField:fieldName inFileType:[pub fileType]]; ! if (isLocalFile) { string = [string stringByReplacingCharactersInSet:slashCharSet withString:@"-"]; } *************** *** 284,288 **** // keywords // look for [slash] ! slash = ([fieldName isEqualToString:BDSKLocalUrlString]) ? @"-" : @"/"; if ([scanner scanString:@"[" intoString:NULL]) { if (![scanner scanUpToString:@"]" intoString:&slash]) slash = @""; --- 286,290 ---- // keywords // look for [slash] ! slash = (isLocalFile) ? @"-" : @"/"; if ([scanner scanString:@"[" intoString:NULL]) { if (![scanner scanUpToString:@"]" intoString:&slash]) slash = @""; *************** *** 351,355 **** [scanner scanString:@"}" intoString:NULL]) { // look for [slash] ! slash = ([fieldName isEqualToString:BDSKLocalUrlString]) ? @"-" : @"/"; if ([scanner scanString:@"[" intoString:NULL]) { if (![scanner scanUpToString:@"]" intoString:&slash]) slash = @""; --- 353,357 ---- [scanner scanString:@"}" intoString:NULL]) { // look for [slash] ! slash = (isLocalFile) ? @"-" : @"/"; if ([scanner scanString:@"[" intoString:NULL]) { if (![scanner scanUpToString:@"]" intoString:&slash]) slash = @""; *************** *** 541,545 **** [[pub document] citeKeyIsUsed:proposedStr byItemOtherThan:pub]); } ! else if ([fieldName isEqualToString:BDSKLocalUrlString]) { if (proposedStr == nil || [proposedStr isEqualToString:@""]) return NO; --- 543,547 ---- [[pub document] citeKeyIsUsed:proposedStr byItemOtherThan:pub]); } ! else if ([[[OFPreferenceWrapper sharedPreferenceWrapper] stringArrayForkey:BDSKLocalFileFieldsKey] containsObject:fieldName]) { if (proposedStr == nil || [proposedStr isEqualToString:@""]) return NO; *************** *** 576,580 **** return newString; } ! else if ([fieldName isEqualToString:BDSKLocalUrlString]) { if (string == nil || [string isEqualToString:@""]) { --- 578,582 ---- return newString; } ! else if ([[[OFPreferenceWrapper sharedPreferenceWrapper] stringArrayForkey:BDSKLocalFileFieldsKey] containsObject:fieldName]) { if (string == nil || [string isEqualToString:@""]) { *************** *** 618,622 **** return newString; } ! else if ([fieldName isEqualToString:BDSKLocalUrlString]) { cleanOption = [[OFPreferenceWrapper sharedPreferenceWrapper] integerForKey:BDSKLocalUrlCleanOptionKey]; --- 620,624 ---- return newString; } ! else if ([[[OFPreferenceWrapper sharedPreferenceWrapper] stringArrayForkey:BDSKLocalFileFieldsKey] containsObject:fieldName]) { cleanOption = [[OFPreferenceWrapper sharedPreferenceWrapper] integerForKey:BDSKLocalUrlCleanOptionKey]; |