Revision: 11531
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=11531&view=rev
Author:   amaxwell
Date:     2007-11-10 10:12:46 -0800 (Sat, 10 Nov 2007)

Log Message:
-----------
remove surrounding braces from google scholar titles

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

Modified: trunk/bibdesk/BDSKGoogleScholarParser.m
===================================================================
--- trunk/bibdesk/BDSKGoogleScholarParser.m     2007-11-10 17:14:46 UTC (rev 
11530)
+++ trunk/bibdesk/BDSKGoogleScholarParser.m     2007-11-10 18:12:46 UTC (rev 
11531)
@@ -141,6 +141,18 @@
             // but it'll take some xpath hacking to make sure we match title 
to bibtex link correctly.
             
             [items addObject:bibtexItem];
+                       
+                       NSString *bracedTitle = [bibtexItem 
valueOfField:BDSKTitleString inherit:NO];
+                       
+                       // google scholar encloses titles in braces to force 
capitalization, but it's better to let styles handle that
+                       if ([bracedTitle hasPrefix:@"{"] && [bracedTitle 
hasSuffix:@"}"]) {
+                NSMutableString *mutableTitle = [bracedTitle mutableCopy];
+                [mutableTitle 
replaceCharactersInRange:NSMakeRange([mutableTitle length] - 1, 1) 
withString:@""];
+                               [mutableTitle 
replaceCharactersInRange:NSMakeRange(0, 1) withString:@""];
+                               if ([mutableTitle 
isStringTeXQuotingBalancedWithBraces:YES connected:NO]) 
+                                       [bibtexItem setField:BDSKTitleString 
toValue:mutableTitle];
+                               [mutableTitle release];
+                       }                               
         }
         else {
             // display a fake item in the table so the user knows one of the 
items failed to parse, but still gets the rest of the data


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