Revision: 22568
          http://sourceforge.net/p/bibdesk/svn/22568
Author:   hofman
Date:     2018-09-09 09:46:21 +0000 (Sun, 09 Sep 2018)
Log Message:
-----------
add url passed with citation download in individual classes

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

Modified: trunk/bibdesk/BDSKAsynchronousWebParser.m
===================================================================
--- trunk/bibdesk/BDSKAsynchronousWebParser.m   2018-09-09 06:30:29 UTC (rev 
22567)
+++ trunk/bibdesk/BDSKAsynchronousWebParser.m   2018-09-09 09:46:21 UTC (rev 
22568)
@@ -156,18 +156,6 @@
 - (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download error:(NSError 
**)outError {
     NSString *bibtexString = [self bibTeXStringFromDownload:download];
     NSArray *bibtexItems = [self itemsFromBibTeXString:bibtexString 
error:outError];
-    BibItem *bibtexItem;
-    
-    if ([[download contextInfo] isKindOfClass:[NSString class]] && (bibtexItem 
= [bibtexItems firstObject])) {
-        NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
-        BOOL addLinkedFiles = NO == [sud boolForKey:BDSKUseLocalUrlAndUrlKey];
-        BOOL addUrlField = addLinkedFiles == NO || [sud 
boolForKey:BDSKAutomaticallyConvertURLFieldsKey] == NO || [sud 
boolForKey:BDSKRemoveConvertedRemoteURLFieldsKey] == NO;
-        if (addUrlField && [NSString isEmptyString:[bibtexItem 
valueOfField:BDSKUrlString inherit:NO]])
-            [bibtexItem setField:BDSKUrlString toValue:[download contextInfo]];
-        if (addLinkedFiles)
-            [bibtexItem addFileForURL:[NSURL URLWithString:[download 
contextInfo]] autoFile:NO runScriptHook:NO];
-    }
-    
     return bibtexItems;
 }
 

Modified: trunk/bibdesk/BDSKHubmedParser.m
===================================================================
--- trunk/bibdesk/BDSKHubmedParser.m    2018-09-09 06:30:29 UTC (rev 22567)
+++ trunk/bibdesk/BDSKHubmedParser.m    2018-09-09 09:46:21 UTC (rev 22568)
@@ -78,6 +78,24 @@
     return nil;
 }
 
+- (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download error:(NSError 
**)outError {
+    NSArray *items = [super itemsFromDownload:download error:outError];
+    
+    BibItem *item = [items firstObject];
+    
+    if (item) {
+        NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
+        BOOL addLinkedFiles = NO == [sud boolForKey:BDSKUseLocalUrlAndUrlKey];
+        BOOL addUrlField = addLinkedFiles == NO || [sud 
boolForKey:BDSKAutomaticallyConvertURLFieldsKey] == NO || [sud 
boolForKey:BDSKRemoveConvertedRemoteURLFieldsKey] == NO;
+        if (addUrlField && [NSString isEmptyString:[item 
valueOfField:BDSKUrlString inherit:NO]])
+            [item setField:BDSKUrlString toValue:[download contextInfo]];
+        if (addLinkedFiles)
+            [item addFileForURL:[NSURL URLWithString:[download contextInfo]] 
autoFile:NO runScriptHook:NO];
+    }
+    
+    return items;
+}
+
 + (NSString *)name {return @"HubMed"; }
 
 + (NSString *)address { return @"http://git.macropus.org/hubmed/";; }

Modified: trunk/bibdesk/BDSKIEEEXploreParser.m
===================================================================
--- trunk/bibdesk/BDSKIEEEXploreParser.m        2018-09-09 06:30:29 UTC (rev 
22567)
+++ trunk/bibdesk/BDSKIEEEXploreParser.m        2018-09-09 09:46:21 UTC (rev 
22568)
@@ -123,6 +123,24 @@
     return nil;
 }
 
+- (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download error:(NSError 
**)outError {
+    NSArray *items = [super itemsFromDownload:download error:outError];
+    
+    BibItem *item = [items firstObject];
+    
+    if (item) {
+        NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
+        BOOL addLinkedFiles = NO == [sud boolForKey:BDSKUseLocalUrlAndUrlKey];
+        BOOL addUrlField = addLinkedFiles == NO || [sud 
boolForKey:BDSKAutomaticallyConvertURLFieldsKey] == NO || [sud 
boolForKey:BDSKRemoveConvertedRemoteURLFieldsKey] == NO;
+        if (addUrlField && [NSString isEmptyString:[item 
valueOfField:BDSKUrlString inherit:NO]])
+            [item setField:BDSKUrlString toValue:[download contextInfo]];
+        if (addLinkedFiles)
+            [item addFileForURL:[NSURL URLWithString:[download contextInfo]] 
autoFile:NO runScriptHook:NO];
+    }
+    
+    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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to