adding pagination patch from Rintze

This commit is contained in:
Matt Burton 2009-04-07 00:53:51 +00:00
parent 5a7f3b1500
commit 92a29a7ad5

View file

@ -84,7 +84,17 @@ function lookupPMIDs(ids, doc) {
}
if (article.Pagination.MedlinePgn.length()){
newItem.pages = article.Pagination.MedlinePgn.text().toString();
var fullPageRange = article.Pagination.MedlinePgn.text().toString();
var pageRange = fullPageRange.match(/\d+-\d+/g);
for (i in pageRange) {
var pageRangeStart = pageRange[i].match(/^\d+/).join("");
var pageRangeEnd = pageRange[i].match(/\d+$/).join("");
if (pageRangeStart.length > pageRangeEnd.length) {
pageRangeEnd = pageRangeStart.substring(0,pageRangeStart.length-pageRangeEnd.length) + pageRangeEnd;
fullPageRange = fullPageRange.replace(pageRange[i],pageRangeStart+"-"+pageRangeEnd);
}
}
newItem.pages = fullPageRange;
}
if(article.Journal.length()) {