Revision: 29416
          http://sourceforge.net/p/bibdesk/svn/29416
Author:   hofman
Date:     2025-08-05 14:40:40 +0000 (Tue, 05 Aug 2025)
Log Message:
-----------
Add URL string to item from downloaded bibtex data when the contextInfo is a 
URL string

Modified Paths:
--------------
    trunk/bibdesk/BDSKACMDLParser.m
    trunk/bibdesk/BDSKAsynchronousWebParser.m
    trunk/bibdesk/BDSKHubmedParser.m
    trunk/bibdesk/BDSKIACRParser.m
    trunk/bibdesk/BDSKIEEEXploreParser.m

Modified: trunk/bibdesk/BDSKACMDLParser.m
===================================================================
--- trunk/bibdesk/BDSKACMDLParser.m     2025-08-04 16:40:44 UTC (rev 29415)
+++ trunk/bibdesk/BDSKACMDLParser.m     2025-08-05 14:40:40 UTC (rev 29416)
@@ -93,14 +93,6 @@
     return nil;
 }
 
-- (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download error:(NSError 
**)outError {
-    NSArray *items = [super itemsFromDownload:download error:outError];
-    
-    [[items firstObject] addURLString:[download contextInfo]];
-    
-    return items;
-}
-
 + (NSString *)name {return @"ACM"; }
 
 + (NSString *)address { return @"https://dl.acm.org/";; }

Modified: trunk/bibdesk/BDSKAsynchronousWebParser.m
===================================================================
--- trunk/bibdesk/BDSKAsynchronousWebParser.m   2025-08-04 16:40:44 UTC (rev 
29415)
+++ trunk/bibdesk/BDSKAsynchronousWebParser.m   2025-08-05 14:40:40 UTC (rev 
29416)
@@ -152,6 +152,9 @@
 - (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download error:(NSError 
**)outError {
     NSString *bibtexString = [self bibTeXStringFromDownload:download];
     NSArray *bibtexItems = [self itemsFromBibTeXString:bibtexString 
error:outError];
+    id contextInfo = [download contextInfo];
+    if ([bibtexItems count] && [contextInfo isKindOfClass:[NSString class]] && 
[contextInfo containsString:@"://"])
+         [[bibtexItems firstObject] addURLString:contextInfo];
     return bibtexItems;
 }
 

Modified: trunk/bibdesk/BDSKHubmedParser.m
===================================================================
--- trunk/bibdesk/BDSKHubmedParser.m    2025-08-04 16:40:44 UTC (rev 29415)
+++ trunk/bibdesk/BDSKHubmedParser.m    2025-08-05 14:40:40 UTC (rev 29416)
@@ -78,14 +78,6 @@
     return nil;
 }
 
-- (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download error:(NSError 
**)outError {
-    NSArray *items = [super itemsFromDownload:download error:outError];
-    
-    [[items firstObject] addURLString:[download contextInfo]];
-    
-    return items;
-}
-
 + (NSString *)name {return @"HubMed"; }
 
 + (NSString *)address { return @"http://git.macropus.org/hubmed/";; }

Modified: trunk/bibdesk/BDSKIACRParser.m
===================================================================
--- trunk/bibdesk/BDSKIACRParser.m      2025-08-04 16:40:44 UTC (rev 29415)
+++ trunk/bibdesk/BDSKIACRParser.m      2025-08-05 14:40:40 UTC (rev 29416)
@@ -105,8 +105,9 @@
             NSString *path = [paperNode stringValueOfAttribute:@"href"];
             NSURL *bibtexURL = [[NSURL URLWithString:path relativeToURL:url] 
absoluteURL];
             NSURLRequest *request = [NSURLRequest requestWithURL:bibtexURL];
+            NSArray *contextInfo = @[[[bibtexURL absoluteString] 
stringByAppendingPathExtension:@"pdf"], [bibtexURL absoluteString]];
             
-            [self addDownloadWithRequest:request contextInfo:[bibtexURL 
absoluteString]];
+            [self addDownloadWithRequest:request contextInfo:contextInfo];
         }
         
     }
@@ -130,10 +131,9 @@
     BibItem *item = [items firstObject];
     
     if (item) {
-        NSString *baseURLString = [download contextInfo];
         [item setField:BDSKUrlString toValue:nil];
-        [item addURLString:[baseURLString 
stringByAppendingPathExtension:@"pdf"]];
-        [item addURLString:baseURLString];
+        for (NSString *urlString in [download contextInfo])
+            [item addURLString:urlString];
     }
     
     return items;

Modified: trunk/bibdesk/BDSKIEEEXploreParser.m
===================================================================
--- trunk/bibdesk/BDSKIEEEXploreParser.m        2025-08-04 16:40:44 UTC (rev 
29415)
+++ trunk/bibdesk/BDSKIEEEXploreParser.m        2025-08-05 14:40:40 UTC (rev 
29416)
@@ -123,14 +123,6 @@
     return nil;
 }
 
-- (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download error:(NSError 
**)outError {
-    NSArray *items = [super itemsFromDownload:download error:outError];
-    
-    [[items firstObject] addURLString:[download contextInfo]];
-    
-    return items;
-}
-
 - (NSString *)bibTeXStringFromDownload:(BDSKCitationDownload *)download {
     NSString *bibTeXString = nil;
     

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



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to