Revision: 18123
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18123&view=rev
Author:   hofman
Date:     2011-09-13 21:06:33 +0000 (Tue, 13 Sep 2011)
Log Message:
-----------
support inspirenet web search from spires parser

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

Modified: trunk/bibdesk/BDSKSpiresParser.m
===================================================================
--- trunk/bibdesk/BDSKSpiresParser.m    2011-09-13 06:34:57 UTC (rev 18122)
+++ trunk/bibdesk/BDSKSpiresParser.m    2011-09-13 21:06:33 UTC (rev 18123)
@@ -52,7 +52,9 @@
     if (spiresHosts == nil)
         spiresHosts = [[NSArray alloc] 
initWithObjects:@"www.slac.stanford.edu", @"www-library.desy.de", 
@"www-spires.fnal.gov", @"usparc.ihep.su", @"www-spires.dur.ac.uk", 
@"www.yukawa.kyoto-u.ac.jp", @"www.spires.lipi.go.id", nil];
     
-    if ([spiresHosts containsObject:[[url host] lowercaseString]] == NO || 
[[[url path] lowercaseString] hasPrefix:@"/spires"] == NO)
+    NSString *host = [[url host] lowercaseString];
+    
+    if ([host isEqualToString:@"inspirebeta.net"] == NO && ([spiresHosts 
containsObject:host] == NO || [[url path] hasCaseInsensitivePrefix:@"/spires"] 
== NO))
         return NO;
     
     NSString *containsBibTexLinkNode = @"//a[contains(text(),'BibTeX')]"; 
@@ -103,8 +105,10 @@
         
         NSString *hrefValue = [btlinknode stringValueOfAttribute:@"href"];
         
+        if ([hrefValue hasCaseInsensitivePrefix:@"http://";] == NO && 
[hrefValue hasCaseInsensitivePrefix:@"https://";] == NO)
+            hrefValue = [NSString stringWithFormat:@"http://%@%@";, [url host], 
hrefValue];
         
-        NSURL *btURL = [NSURL URLWithString:[NSString 
stringWithFormat:@"http://%@%@";, [url host], hrefValue]];
+        NSURL *btURL = [NSURL URLWithString:hrefValue];
         
         NSXMLDocument *btXMLDoc = [[NSXMLDocument alloc] 
initWithContentsOfURL:btURL options:NSXMLDocumentTidyHTML error:&error];
         

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


------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
Learn about the latest advances in developing for the 
BlackBerry® mobile platform with sessions, labs & more.
See new tools and technologies. Register for BlackBerry® DevCon today!
http://p.sf.net/sfu/rim-devcon-copy1 
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to