Revision: 22791
          http://sourceforge.net/p/bibdesk/svn/22791
Author:   hofman
Date:     2018-10-10 21:22:15 +0000 (Wed, 10 Oct 2018)
Log Message:
-----------
don't allow deprecated arguments in parse format command with preferred context 
specifier, as this information is already passed implicitly

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

Modified: trunk/bibdesk/BDSKParseFormatCommand.m
===================================================================
--- trunk/bibdesk/BDSKParseFormatCommand.m      2018-10-10 16:51:49 UTC (rev 
22790)
+++ trunk/bibdesk/BDSKParseFormatCommand.m      2018-10-10 21:22:15 UTC (rev 
22791)
@@ -71,6 +71,16 @@
        
     if ([spec isKindOfClass:[NSScriptObjectSpecifier class]]) {
         // preferred format, reference to the cite key, a field, or a linked 
file
+        if (indexNumber) {
+            [self setScriptErrorNumber:NSArgumentsWrongScriptError];
+            [self setScriptErrorString:@"Cannot pass both a specifier and an 
index."];
+            return nil;
+        }
+        if (fromPub) {
+            [self setScriptErrorNumber:NSArgumentsWrongScriptError];
+            [self setScriptErrorString:@"Cannot pass both a specifier and a 
publication."];
+            return nil;
+        }
         if ([spec isKindOfClass:[NSPropertySpecifier class]] && [[spec key] 
isEqualToString:@"scriptingCiteKey"]) {
             pub = [[spec containerSpecifier] objectsByEvaluatingSpecifier];
             field = BDSKCiteKeyString;
@@ -95,7 +105,7 @@
         }
         if (pub == nil) {
             [self setScriptErrorNumber:NSArgumentsWrongScriptError];
-            [self setScriptErrorString:@"The 'for' argument should be a field, 
linked file, or cite key"];
+            [self setScriptErrorString:@"The 'for' argument should be a field, 
linked file, or cite key specifier"];
             return nil;
         }
     } else {
@@ -112,25 +122,15 @@
        }
     if ([pub isKindOfClass:[BibItem class]] == NO) {
         [self setScriptErrorNumber:NSArgumentsWrongScriptError];
-        [self setScriptErrorString:@"The 'form' argument is not a 
publication"];
+        [self setScriptErrorString:@"Container or 'from' argument is not a 
publication"];
         return nil;
     }
-    if (fromPub && fromPub != pub) {
-        [self setScriptErrorNumber:NSArgumentsWrongScriptError];
-        [self setScriptErrorString:@"The 'from' argument is different from the 
implied publication"];
-        return nil;
-    }
     if ([field isKindOfClass:[NSString class]] == NO) {
         [self setScriptErrorNumber:NSArgumentsWrongScriptError];
         [self setScriptErrorString:@"Invalid 'for' argument"];
         return nil;
     }
-    if (indexNumber && [indexNumber integerValue] != i + 1) {
-        [self setScriptErrorNumber:NSArgumentsWrongScriptError];
-        [self setScriptErrorString:@"The 'file at index' argument is different 
from the linked file index"];
-        return nil;
-    }
-
+    
     if ([field isEqualToString:BDSKCiteKeyString] == NO && [field 
isEqualToString:BDSKLocalFileString] == NO)         field = [field fieldName];
     
        NSString *error = nil;

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



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to