Revision: 28122
http://sourceforge.net/p/bibdesk/svn/28122
Author: hofman
Date: 2022-12-15 18:32:18 +0000 (Thu, 15 Dec 2022)
Log Message:
-----------
use bibtex string convenience method for IACR parser
Modified Paths:
--------------
trunk/bibdesk/BDSKIACRParser.m
Modified: trunk/bibdesk/BDSKIACRParser.m
===================================================================
--- trunk/bibdesk/BDSKIACRParser.m 2022-12-15 18:07:41 UTC (rev 28121)
+++ trunk/bibdesk/BDSKIACRParser.m 2022-12-15 18:32:18 UTC (rev 28122)
@@ -119,34 +119,29 @@
return nil;
}
-- (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download error:(NSError
**)outError {
- NSXMLDocument *xmlDoc = [[[NSXMLDocument alloc] initWithData:[download
data] options:NSXMLDocumentTidyHTML error:outError] autorelease];
+- (NSString *)bibTeXStringFromDownload:(BDSKCitationDownload *)download {
+ NSXMLDocument *xmlDoc = [[[NSXMLDocument alloc] initWithData:[download
data] options:NSXMLDocumentTidyHTML error:NULL] autorelease];
if (xmlDoc == nil)
return nil;
NSXMLNode *bibtexNode = [[[xmlDoc rootElement]
nodesForXPath:@"./body//pre[@id='bibtex']" error:NULL] firstObject];
+
+ return [[bibtexNode stringValue]
stringByCollapsingWhitespaceAndRemovingSurroundingWhitespace];
+}
+
+- (NSArray *)itemsFromDownload:(BDSKCitationDownload *)download error:(NSError
**)outError {
+ NSArray *items = [super itemsFromDownload:download error:outError];
+ BibItem *item = [items firstObject];
- if (bibtexNode) {
+ if (item) {
NSString *baseURLString = [[download contextInfo]
objectForKey:@"baseURLString"];
- AGRegex *yrnRegex = [AGRegex
regexWithPattern:@"^/([0-9]{4})/([0-9]+)$"];
- AGRegexMatch *yrnMatch = [yrnRegex findInString:[[NSURL
URLWithString:baseURLString] path]];
- NSString *year = [yrnMatch groupAtIndex:1];
- NSString *reportNum = [yrnMatch groupAtIndex:2];
-
- NSString *bibtexString = [[bibtexNode stringValue]
stringByTrimmingCharactersInSet:[NSCharacterSet
whitespaceAndNewlineCharacterSet]];
- BibItem *item = [[self itemsFromBibTeXString:bibtexString error:NULL]
firstObject];
-
- if (item) {
- [item setField:BDSKUrlString toValue:nil];
- [item addURLString:[baseURLString
stringByAppendingPathExtension:@"pdf"]];
- [item addURLString:baseURLString];
- }
-
- return [NSArray arrayWithObjects:item, nil];
+ [item setField:BDSKUrlString toValue:nil];
+ [item addURLString:[baseURLString
stringByAppendingPathExtension:@"pdf"]];
+ [item addURLString:baseURLString];
}
- return nil;
+ return items;
}
+ (NSString *)address { return @"https://eprint.iacr.org/"; }
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