Revision: 22537
http://sourceforge.net/p/bibdesk/svn/22537
Author: hofman
Date: 2018-08-27 13:53:44 +0000 (Mon, 27 Aug 2018)
Log Message:
-----------
get text from full document node if body is not available
Modified Paths:
--------------
trunk/bibdesk/BDSKBibTeXWebParser.m
trunk/bibdesk/BDSKDOIWebParser.m
Modified: trunk/bibdesk/BDSKBibTeXWebParser.m
===================================================================
--- trunk/bibdesk/BDSKBibTeXWebParser.m 2018-08-27 06:30:31 UTC (rev 22536)
+++ trunk/bibdesk/BDSKBibTeXWebParser.m 2018-08-27 13:53:44 UTC (rev 22537)
@@ -46,7 +46,7 @@
+ (BOOL)canParseDocument:(DOMDocument *)domDocument fromURL:(NSURL *)url{
- NSString *text = [[domDocument body] textContent];
+ NSString *text = [[domDocument body] ?: domDocument textContent];
AGRegex *bibtexRegex = [AGRegex regexWithPattern:@"@[[:alpha:]]+[
\\t]*[{(]"];
return nil != [bibtexRegex findInString:text];
@@ -57,7 +57,7 @@
NSMutableArray *items = [NSMutableArray array];
- NSString *text = [[[self domDocument] body] textContent];
+ NSString *text = [[[self domDocument] body] ?: [self domDocument]
textContent];
AGRegex *bibtexRegex = [AGRegex regexWithPattern:@"@[[:alpha:]]+[
\\t]*[{(]"];
Modified: trunk/bibdesk/BDSKDOIWebParser.m
===================================================================
--- trunk/bibdesk/BDSKDOIWebParser.m 2018-08-27 06:30:31 UTC (rev 22536)
+++ trunk/bibdesk/BDSKDOIWebParser.m 2018-08-27 13:53:44 UTC (rev 22537)
@@ -56,7 +56,7 @@
if (nil != [rootElement singleNodeForXPath:bodyADoiXPath])
return YES;
- NSString *text = [[domDocument body] textContent];
+ NSString *text = [[domDocument body] ?: domDocument textContent];
AGRegex *doiRegex = [AGRegex regexWithPattern:@"(doi:[
\\t]*|https?://(dx\\.)?doi\\.org/)10\\.[0-9]{4,}(\\.[0-9]+)*/\\S+"
options:AGRegexCaseInsensitive];
return nil != [doiRegex findInString:text];
@@ -99,7 +99,7 @@
}
if ([dois count] == 0) {
- NSString *text = [[[self domDocument] body] textContent];
+ NSString *text = [[[self domDocument] body] ?: [self domDocument]
textContent];
doiRegex = [AGRegex regexWithPattern:@"(doi:[
\\t]*|https?://(dx\\.)?doi\\.org/)(10\\.[0-9]{4,}(\\.[0-9]+)*/\\S+)"
options:AGRegexCaseInsensitive];
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