Revision: 15290
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=15290&view=rev
Author:   amaxwell
Date:     2009-05-08 17:32:59 +0000 (Fri, 08 May 2009)

Log Message:
-----------
Disable titlecasing by default, since PubMed seems to use a consistent
system.  Save the full title in "Journal-Full" if the MedlineTA field
is used, and don't titlecase MedlineTA.

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

Modified: trunk/bibdesk/BDSKPubMedXMLParser.m
===================================================================
--- trunk/bibdesk/BDSKPubMedXMLParser.m 2009-05-08 17:15:52 UTC (rev 15289)
+++ trunk/bibdesk/BDSKPubMedXMLParser.m 2009-05-08 17:32:59 UTC (rev 15290)
@@ -67,7 +67,7 @@
 
 @implementation BDSKPubMedXMLParser
 
-static bool _useTitlecase = true;
+static bool _useTitlecase = false;
 #ifdef OMNI_ASSERTIONS_ON
 static bool _addXMLStringToAnnote = true;
 #else
@@ -79,9 +79,9 @@
     // this is messy, but may be useful for debugging
     if ([[NSUserDefaults standardUserDefaults] 
boolForKey:@"BDSKAddPubMedXMLStringToAnnote"])
         _addXMLStringToAnnote = true;
-    // try to allow for common titlecasing in PubMed (which gives us sentence 
case journal titles)
-    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:@"BDSKDisablePubMedXMLTitleCasing"])
-        _useTitlecase = false;
+    // allow for common titlecasing in PubMed if needed, but it seems to 
capitalize places and proper names correctly
+    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:@"BDSKEnablePubMedXMLTitleCasing"])
+        _useTitlecase = true;
 }
 
 + (BOOL)canParseString:(NSString *)string;
@@ -317,11 +317,6 @@
         NSMutableDictionary *pubFields = [NSMutableDictionary new];
         
         [self _addJournalNode:[citation 
firstNodeForXPath:@"./Article/Journal"] toDictionary:pubFields];
-
-        // Replace Journal Title by MedlineTA if available
-        NSString* MedlineTA = [[citation 
firstNodeForXPath:@"./MedlineJournalInfo/MedlineTA"] stringValue];
-        addStringToDictionaryIfNotNil(_useTitlecase ? [MedlineTA 
titlecaseString] : MedlineTA, BDSKJournalString, pubFields);
-
         [self _addAuthorListNode:[citation 
firstNodeForXPath:@"./Article/AuthorList"] toDictionary:pubFields];
         
         // ex. PMID 16187791
@@ -334,6 +329,17 @@
         addStringValueOfNodeForField([citation 
firstNodeForXPath:@"./Article/Pagination/MedlinePgn"], BDSKPagesString, 
pubFields);
         addStringValueOfNodeForField([citation firstNodeForXPath:@"./PMID"], 
@"Pmid", pubFields);
         
+        // use MedlineTA if available, since the full title evidently has too 
much information in some cases
+        NSString *ta = [[citation 
firstNodeForXPath:@"./MedlineJournalInfo/MedlineTA"] stringValue];        
+        if (ta) {
+            // save the full title in another field
+            if ([pubFields objectForKey:BDSKJournalString])
+                [pubFields setObject:[pubFields 
objectForKey:BDSKJournalString] forKey:@"Journal-Full"];
+            
+            // titlecasing this doesn't seem right, since it's already 
abbreviated
+            [pubFields setObject:ta forKey:BDSKJournalString];
+        }
+        
         // grab the DOI if available
         NSArray *articleIDs = [article 
nodesForXPath:@"./PubmedData/ArticleIdList/ArticleId" error:NULL];
         NSEnumerator *articleIDEnum = [articleIDs objectEnumerator];


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

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to