Revision: 10936
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=10936&view=rev
Author:   amaxwell
Date:     2007-08-17 12:17:39 -0700 (Fri, 17 Aug 2007)

Log Message:
-----------
Hidden default so users can preserve the short journal name in a separate field 
instead of adding it to annote.  Disabled by default.

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

Modified: trunk/bibdesk/BDSKSciFinderParser.m
===================================================================
--- trunk/bibdesk/BDSKSciFinderParser.m 2007-08-17 18:41:31 UTC (rev 10935)
+++ trunk/bibdesk/BDSKSciFinderParser.m 2007-08-17 19:17:39 UTC (rev 10936)
@@ -71,16 +71,17 @@
 
 // this is a set of fields that don't need any massaging; the key/value match 
BibTeX definitions
 static NSSet *correctFields = nil;
+static NSString *shortJournalNameString = nil;
+// some more-or-less unique string that meets our field name criteria (leading 
cap, no space)
+static NSString *__documentTypeString = @"Doc-Type";
 
 + (void)initialize
 {
     OBINITIALIZE;
     correctFields = [[NSSet alloc] initWithObjects:BDSKVolumeString, 
@"Language", BDSKAbstractString, nil];
+    shortJournalNameString = [[[[NSUserDefaults standardUserDefaults] 
objectForKey:@"BDSKShortJournalNameField"] fieldName] copy];
 }
 
-// some more-or-less unique string that meets our field name criteria (leading 
cap, no space)
-static NSString *__documentTypeString = @"Doc-Type";
-
 static void addKeyValueToAnnote(NSString *key, NSString *value, 
NSMutableDictionary *pubFields)
 {
     NSMutableString *mutString = [pubFields objectForKey:BDSKAnnoteString];
@@ -107,16 +108,26 @@
         // apparently one of the databases returns journal names in all caps
         if ([value rangeOfCharacterFromSet:[NSCharacterSet 
lowercaseLetterCharacterSet]].location == NSNotFound)
             value = [value titlecaseString];
-        // if we previously used the short title, save it off in Annote
-        if ([pubFields objectForKey:key] != nil)
-            addKeyValueToAnnote(@"Journal Title", [pubFields 
objectForKey:key], pubFields);
+        
+        // if we previously used the short title for Journal, save it off in 
Annote
+        if ([pubFields objectForKey:key] != nil) {
+            if (nil == shortJournalNameString)
+                addKeyValueToAnnote(@"Journal Title", [pubFields 
objectForKey:key], pubFields);
+            else
+                [pubFields setObject:[pubFields objectForKey:key] 
forKey:shortJournalNameString];
+        }
     }
     else if ([key isEqualToString:@"Journal Title"]) {
         key = BDSKJournalString;
-        // if we already have a Journal definition, bail out, because it's 
from "Full Journal Title"
+        
+        // if we already have a Journal definition, it's from the full title, 
so keep it
         if ([pubFields objectForKey:key] != nil) {
-            addKeyValueToAnnote(key, value, pubFields);
-            return;
+            // add it to annote and bail out, unless the user wants to put it 
in a special field
+            if (nil == shortJournalNameString) {
+                addKeyValueToAnnote(@"Journal Title", value, pubFields);
+                return;
+            }
+            else key = shortJournalNameString;
         }
         // apparently one of the databases returns journal names in all caps
         if ([value rangeOfCharacterFromSet:[NSCharacterSet 
lowercaseLetterCharacterSet]].location == NSNotFound)


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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to