Revision: 22186
          http://sourceforge.net/p/bibdesk/svn/22186
Author:   hofman
Date:     2018-04-16 20:42:45 +0000 (Mon, 16 Apr 2018)
Log Message:
-----------
Fix dictionary key. Rename method name and arguments. 

Modified Paths:
--------------
    trunk/bibdesk/BDSKIUCrParser.m
    trunk/bibdesk/BDSKMathSciNetParser.h
    trunk/bibdesk/BDSKMathSciNetParser.m
    trunk/bibdesk/BDSKNumdamParser.m
    trunk/bibdesk/BDSKProjectEuclidParser.m
    trunk/bibdesk/BDSKZentralblattParser.h
    trunk/bibdesk/BDSKZentralblattParser.m

Modified: trunk/bibdesk/BDSKIUCrParser.m
===================================================================
--- trunk/bibdesk/BDSKIUCrParser.m      2018-04-16 06:30:25 UTC (rev 22185)
+++ trunk/bibdesk/BDSKIUCrParser.m      2018-04-16 20:42:45 UTC (rev 22186)
@@ -42,7 +42,7 @@
 
 @implementation BDSKIUCrParser
 
-+ (NSString *)citationNodeXPath { return 
@"./body//table[@class='citation']/tbody/tr/td/input[@name='cnor' and 
string-length(@value)!=0]"; }
++ (NSString *)citationNodeXPath { return 
@"./body//table[@class='citation']//td/input[@name='cnor' and 
string-length(@value)!=0]"; }
 
 + (NSString *)citationURLStringFromNode:(NSXMLNode *)node {
     NSString *cnorValue = [node stringValueOfAttribute:@"value"];

Modified: trunk/bibdesk/BDSKMathSciNetParser.h
===================================================================
--- trunk/bibdesk/BDSKMathSciNetParser.h        2018-04-16 06:30:25 UTC (rev 
22185)
+++ trunk/bibdesk/BDSKMathSciNetParser.h        2018-04-16 20:42:45 UTC (rev 
22186)
@@ -43,5 +43,5 @@
 
 @interface BDSKMathSciNetParser : BDSKAsynchronousWebParser
 + (NSArray *)bibTeXRequestsForMRIDs:(NSArray *)IDs referrer:(NSURL *)URL 
error:(NSError **)outError;
-+ (NSArray *)bibItemsFromBibTeXString:(NSString *)bibTeXString fromURL:(NSURL 
*)bibTeXURL owner:(id<BDSKOwner>)owner error:(NSError **)outError;
++ (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download 
owner:(id<BDSKOwner>)owner error:(NSError **)outError;
 @end

Modified: trunk/bibdesk/BDSKMathSciNetParser.m
===================================================================
--- trunk/bibdesk/BDSKMathSciNetParser.m        2018-04-16 06:30:25 UTC (rev 
22185)
+++ trunk/bibdesk/BDSKMathSciNetParser.m        2018-04-16 20:42:45 UTC (rev 
22186)
@@ -95,7 +95,7 @@
     NSString *bibTeXString = [download string];
     
     if (bibTeXString)
-        results = [BDSKMathSciNetParser bibItemsFromBibTeXString:bibTeXString 
fromURL:[download URL] owner:[self delegate] error:outError];
+        results = [BDSKMathSciNetParser itemsFromDownload:download owner:[self 
delegate] error:outError];
     
     return results;
 }
@@ -135,10 +135,10 @@
 }
 
 // Parses the bibTeX string returned from a request to get an array of 
BibItems.
-+ (NSArray *)bibItemsFromBibTeXString:(NSString *)bibTeXString fromURL:(NSURL 
*)bibTeXURL owner:(id<BDSKOwner>)owner error:(NSError **)outError {
++ (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download 
owner:(id<BDSKOwner>)owner error:(NSError **)outError {
     NSError * error = nil;
     
-    NSXMLDocument * resultsPage = [[[NSXMLDocument alloc] 
initWithXMLString:bibTeXString options: NSXMLDocumentTidyHTML error:&error] 
autorelease];
+    NSXMLDocument * resultsPage = [[[NSXMLDocument alloc] 
initWithData:[download data] options: NSXMLDocumentTidyHTML error:&error] 
autorelease];
     
     if ((error != nil)  && (resultsPage == nil)) {
         // Only return with an error if we don't receive an XML object back.
@@ -178,7 +178,7 @@
     // Add a URL reference pointing to the review's web page to each record.
     for (BibItem * item in results) {
         NSString * MRNumber = [[item citeKey] stringByRemovingPrefix:@"MR"];
-        NSURL * MRItemURL = [[NSURL URLWithString:[@"/mathscinet-getitem?mr=" 
stringByAppendingString:MRNumber] relativeToURL:bibTeXURL] absoluteURL];
+        NSURL * MRItemURL = [[NSURL URLWithString:[@"/mathscinet-getitem?mr=" 
stringByAppendingString:MRNumber] relativeToURL:[download URL]] absoluteURL];
         [item addFileForURL:MRItemURL autoFile:NO runScriptHook:NO];
     }
     

Modified: trunk/bibdesk/BDSKNumdamParser.m
===================================================================
--- trunk/bibdesk/BDSKNumdamParser.m    2018-04-16 06:30:25 UTC (rev 22185)
+++ trunk/bibdesk/BDSKNumdamParser.m    2018-04-16 20:42:45 UTC (rev 22186)
@@ -140,13 +140,11 @@
 
 - (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download error:(NSError 
**)outError {
     NSArray *results = nil;
-    NSString *bibTeXString = [download string];
     NSDictionary *contextInfo = [download contextInfo];
     Class parserClass = (Class)[contextInfo objectForKey:@"parserClass"];
     NSString *content = [contextInfo objectForKey:@"content"];
     
-    if (bibTeXString)
-        results = [parserClass bibItemsFromBibTeXString:bibTeXString 
fromURL:[download URL] owner:[self delegate] error:outError];
+    results = [parserClass itemsFromDownload:download owner:[self delegate] 
error:outError];
     
     if ([results count] > 0 && content != nil) {
         // add Numdam URL to item's own record

Modified: trunk/bibdesk/BDSKProjectEuclidParser.m
===================================================================
--- trunk/bibdesk/BDSKProjectEuclidParser.m     2018-04-16 06:30:25 UTC (rev 
22185)
+++ trunk/bibdesk/BDSKProjectEuclidParser.m     2018-04-16 20:42:45 UTC (rev 
22186)
@@ -110,7 +110,7 @@
         
         NSString *myIdentifier = myMRID ? identifierString : nil;
         for (NSURLRequest *request in MRRequests) {
-            NSDictionary *contextInfo = [NSDictionary 
dictionaryWithObjectsAndKeys:[BDSKMathSciNetParser class], @"parserClass", 
myIdentifier, @"identifier", nil];
+            NSDictionary *contextInfo = [NSDictionary 
dictionaryWithObjectsAndKeys:[BDSKMathSciNetParser class], @"parserClass", 
myIdentifier, @"myIdentifier", nil];
             [self addDownloadWithRequest:request contextInfo:contextInfo];
             myIdentifier = nil;
         }
@@ -132,14 +132,11 @@
 - (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download error:(NSError 
**)outError {
     NSArray *results = nil;
     NSError *error = nil;
-    NSString *bibTeXString = [download string];
     NSDictionary *contextInfo = [download contextInfo];
     Class parserClass = (Class)[contextInfo objectForKey:@"parserClass"];
     NSString *myIdentifier = [contextInfo objectForKey:@"myIdentifier"];
     
-    if (bibTeXString)
-        // parse the bibTeX string with the correct parser
-        results = [parserClass bibItemsFromBibTeXString:bibTeXString 
fromURL:[download URL] owner:[self delegate] error:&error];
+    results = [parserClass itemsFromDownload:download owner:[self delegate] 
error:&error];
     
     if ([results count] > 0 && myIdentifier != nil) {
         // add Project Euclid URL to item's own record

Modified: trunk/bibdesk/BDSKZentralblattParser.h
===================================================================
--- trunk/bibdesk/BDSKZentralblattParser.h      2018-04-16 06:30:25 UTC (rev 
22185)
+++ trunk/bibdesk/BDSKZentralblattParser.h      2018-04-16 20:42:45 UTC (rev 
22186)
@@ -43,5 +43,5 @@
 
 @interface BDSKZentralblattParser : BDSKAsynchronousWebParser
 + (NSArray *)bibTeXRequestsForZMathIDs:(NSArray *)IDs referrer:(NSURL 
*)referrer error:(NSError **) outError;
-+ (NSArray *)bibItemsFromBibTeXString:(NSString *)bibTeXString fromURL:(NSURL 
*)bibTeXURL owner:(id<BDSKOwner>)owner error:(NSError **)outError;
++ (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download 
owner:(id<BDSKOwner>)owner error:(NSError **)outError;
 @end

Modified: trunk/bibdesk/BDSKZentralblattParser.m
===================================================================
--- trunk/bibdesk/BDSKZentralblattParser.m      2018-04-16 06:30:25 UTC (rev 
22185)
+++ trunk/bibdesk/BDSKZentralblattParser.m      2018-04-16 20:42:45 UTC (rev 
22186)
@@ -95,7 +95,7 @@
     NSError *error = nil;
     
     if (bibTeXString) {
-        results = [BDSKZentralblattParser 
bibItemsFromBibTeXString:bibTeXString fromURL:[download URL] owner:[self 
delegate] error:&error];
+        results = [BDSKZentralblattParser itemsFromDownload:download 
owner:[self delegate] error:&error];
         if ([results count] && [error 
isLocalErrorWithCode:kBDSKBibTeXParserFailed])
             results = nil;
     }
@@ -148,7 +148,9 @@
 }
 
 // Parses a returned bibTeX string to get an array of BibItems.
-+ (NSArray *)bibItemsFromBibTeXString:(NSString *)bibTeXString fromURL:(NSURL 
*)bibTeXURL owner:(id<BDSKOwner>)owner error:(NSError **)outError{
++ (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download 
owner:(id<BDSKOwner>)owner error:(NSError **)outError {
+    NSString * bibTeXString = [download string];
+    
     /*    ZMath sometimes uses \"o for umlauts which is incorrect, fix that by 
adding brackets around it for the parser to work. Also add brackets to acute 
and grave accents, so BibDesk translates them to Unicode properly for display */
     AGRegex * umlautFixer = [AGRegex regexWithPattern:@"(\\\\[\"'`][a-zA-Z])" 
options:AGRegexMultiline];
 

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
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to