@@ -84,18 +84,29 @@ function pubMedParse(xml) {
84
84
}
85
85
var abstr1 = path ( article , [ 'Abstract' , 0 , 'AbstractText' , 0 , '_' ] ) ;
86
86
var abstr2 = path ( article , [ 'Abstract' , 0 , 'AbstractText' , 0 ] ) ;
87
+ var pagesStr = path ( article , [ 'Pagination' , 0 , 'MedlinePgn' , 0 ] ) ;
88
+ var spage , epage ,
89
+ pages = / ( [ 0 - 9 ] { 1 , } ) * - * ( [ 0 - 9 ] { 1 , } ) / . exec ( pagesStr ) ;
90
+ if ( pages ) {
91
+ spage = pages [ 1 ] ;
92
+ epage = pages [ 2 ] ;
93
+ } else {
94
+ spage = pagesStr ;
95
+ }
96
+ var issueYear = path ( article , [ 'Journal' , 0 , 'JournalIssue' , 0 , 'PubDate' , 0 , 'Year' , 0 ] ) ;
97
+ var articleYear = path ( article , [ 'ArticleDate' , 0 , 'Year' , 0 ] ) ;
87
98
return {
88
99
source : 'PubMed' ,
89
100
authors : authors ,
90
101
doi : doipath ,
91
102
href : typeof doipath !== 'undefined' ? "http://dx.doi.org/" + doipath : undefined ,
92
103
title : path ( article , [ 'ArticleTitle' , 0 ] ) ,
93
- year : path ( article , [ 'ArticleDate' , 0 , 'Year' , 0 ] ) ,
104
+ year : articleYear || issueYear ,
94
105
publishedIn : path ( article , [ 'Journal' , 0 , 'Title' , 0 ] ) ,
95
106
volume : path ( article , [ 'Journal' , 0 , 'JournalIssue' , 0 , 'Volume' , 0 ] ) ,
96
107
issue : path ( article , [ 'Journal' , 0 , 'JournalIssue' , 0 , 'Issue' , 0 ] ) ,
97
- spage : undefined ,
98
- epage : undefined ,
108
+ spage : spage || undefined ,
109
+ epage : epage ,
99
110
firstauthor : authors [ 0 ] || [ ] ,
100
111
editors : undefined ,
101
112
fullCitation : undefined ,
0 commit comments