Revision: 22518
          http://sourceforge.net/p/bibdesk/svn/22518
Author:   hofman
Date:     2018-08-23 21:20:51 +0000 (Thu, 23 Aug 2018)
Log Message:
-----------
Combine paths

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

Modified: trunk/bibdesk/BDSKArxivParser.m
===================================================================
--- trunk/bibdesk/BDSKArxivParser.m     2018-08-23 21:07:11 UTC (rev 22517)
+++ trunk/bibdesk/BDSKArxivParser.m     2018-08-23 21:20:51 UTC (rev 22518)
@@ -104,8 +104,7 @@
     DOMXPathExpression *abstractNodePath = nil;
     
     if (isAbstract) {
-        arxivLinkNodePath = [[self domDocument] 
createExpression:@"./div[@class='metatable']/table//td[@class='tablecell 
arxivid']" resolver:nil];
-        arxivIDNodePath = [[self domDocument] 
createExpression:@"./a[contains(text(),'arXiv:')]" resolver:nil];
+        arxivIDNodePath = [[self domDocument] 
createExpression:@"./div[@class='metatable']/table//td[@class='tablecell 
arxivid']/a[contains(text(),'arXiv:')]" resolver:nil];
         
         pdfURLNodePath = [[self domDocument] 
createExpression:@"../div[@class='extra-services']/div[@class='full-text']/ul/li/a[contains(text(),'PDF')]"
 resolver:nil];
         doiNodePath = [[self domDocument] 
createExpression:@"./div[@class='metatable']/table//td[@class='tablecell 
doi']/a" resolver:nil];
@@ -160,23 +159,20 @@
     
     for (DOMNode *arxivSearchResult in arxivSearchResults) {
         
-        // fetch the arxiv links
-        DOMNode *arxivNode = [arxivSearchResult 
singleNodeForXPathExpression:arxivLinkNodePath];
-        
-        if (arxivNode == nil) {
-            // If arXiv ever start providing multiple alternative bibtex links 
for a
-            // single item we will need to deal with that
-            NSLog(@"ArXiv Error: unable to parse bibtex url from search 
result");
-            continue;
-        }
-        
         NSMutableDictionary *pubFields = [NSMutableDictionary dictionary];
         NSMutableArray *pubFiles = [NSMutableArray array];
         NSString *string = nil;
-        
         NSArray *nodes;
         DOMNode *node;
+        DOMNode *arxivNode;
         
+        // fetch the arxiv links
+        if (arxivLinkNodePath) {
+            arxivNode = [arxivSearchResult 
singleNodeForXPathExpression:arxivLinkNodePath];
+        } else {
+            arxivNode = arxivSearchResult;
+        }
+        
         // search for arXiv ID
         node = [arxivNode singleNodeForXPathExpression:arxivIDNodePath];
         if (node) {
@@ -195,9 +191,6 @@
             }
         }
         
-        if (isAbstract)
-            arxivNode = arxivSearchResult;
-        
         // search for PDF
         node = [arxivNode singleNodeForXPathExpression:pdfURLNodePath];
         if (node) {

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


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to