Revision: 27773
          http://sourceforge.net/p/bibdesk/svn/27773
Author:   hofman
Date:     2022-07-27 21:33:35 +0000 (Wed, 27 Jul 2022)
Log Message:
-----------
check for universal cite key format when parsing unique specifier

Modified Paths:
--------------
    trunk/bibdesk/BDSKFormatParser.m

Modified: trunk/bibdesk/BDSKFormatParser.m
===================================================================
--- trunk/bibdesk/BDSKFormatParser.m    2022-07-27 18:27:04 UTC (rev 27772)
+++ trunk/bibdesk/BDSKFormatParser.m    2022-07-27 21:33:35 UTC (rev 27773)
@@ -156,6 +156,7 @@
        unichar specifier, uniqueSpecifier = 0;
     NSString *uniquePrefix = nil;
     NSString *uniqueSuffix = nil;
+    BOOL isUniversal = NO;
        NSCharacterSet *slashCharSet = [NSCharacterSet 
characterSetWithCharactersInString:@"/"];
     BOOL isCiteKey = [fieldName isEqualToString:BDSKCiteKeyString];
     BOOL isLocalFile = [fieldName isGeneralLocalFileField];
@@ -164,6 +165,7 @@
     [scanner setCharactersToBeSkipped:nil];
        
        while (NO == [scanner isAtEnd]) {
+        isUniversal = NO;
                // scan non-specifier parts
         NSString *string = nil;
                if ([scanner scanUpToString:@"%" intoString:&string]) {
@@ -737,6 +739,7 @@
                         else if (uniqueNumber > 0)
                             uniqueSuffix = [uniqueSuffix fieldName];
                         parsedStr = [NSMutableString string];
+                        isUniversal = uniqueNumber == 2 && [format 
hasPrefix:@"%a1:%Y%u["];
                                        }
                                        else {
                                                NSLog(@"Specifier %%%C can only 
be used once in the format.", specifier);
@@ -817,7 +820,6 @@
             
             NSUInteger hash = NSNotFound;
             if (uniqueNumber > 0 && (uniquePrefix || uniqueSuffix)) {
-                BOOL isUniversal = uniqueNumber == 2 && [format 
hasPrefix:@"%a1:%Y%u["] && [format hasSuffix:@"]2"] && [format 
rangeOfCharacterFromSet:[[BDSKTypeManager sharedManager] 
invalidCharactersForField:BDSKCiteKeyString] options:0 range:NSMakeRange(9, 
[format length] - 11)].location == NSNotFound;
                 hash = hashedField(pub, uniquePrefix ?: uniqueSuffix, 
isUniversal);
                 if (hash == NSNotFound && uniquePrefix && uniqueSuffix)
                     hash = hashedField(pub, uniqueSuffix, isUniversal);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to