From 473d9e3c17839598cf8309ac3d3d62f7581f05dc Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 12 Jan 2010 23:07:19 +0000 Subject: [PATCH] numPages fixes for BibTeX, MARC, Google Books --- translators/BibTeX.js | 13 +++++++++++-- translators/Google Books.js | 6 +++--- translators/MARC.js | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/translators/BibTeX.js b/translators/BibTeX.js index c4f6d28ce2..27754304c4 100644 --- a/translators/BibTeX.js +++ b/translators/BibTeX.js @@ -8,7 +8,7 @@ "maxVersion":"", "priority":200, "inRepository":true, - "lastUpdated":"2009-12-28 01:50:00" + "lastUpdated":"2010-01-12 11:40:00" } Zotero.configure("dataMode", "block"); @@ -1600,7 +1600,12 @@ function processField(item, field, value) { item.date = value; } } else if(field == "pages") { - item.pages = value.replace(/--/g, "-"); + if (item.itemType == "book" || item.itemType == "thesis" || item.itemType == "manuscript") { + item.numPages = value; + } + else { + item.pages = value.replace(/--/g, "-"); + } } else if(field == "note") { item.extra += "\n"+value; } else if(field == "howpublished") { @@ -2026,6 +2031,10 @@ function doExport() { writeField("pages", item.pages.replace("-","--")); } + if(item.numPages) { + writeField("pages", item.numPages); + } + if(item.itemType == "webpage") { writeField("howpublished", item.url); } diff --git a/translators/Google Books.js b/translators/Google Books.js index d82c5e36ff..ca7432ea94 100644 --- a/translators/Google Books.js +++ b/translators/Google Books.js @@ -8,7 +8,7 @@ "maxVersion":"", "priority":100, "inRepository":true, - "lastUpdated":"2009-12-17 08:15:00" + "lastUpdated":"2010-01-12 11:25:00" } @@ -80,9 +80,9 @@ function doWeb(doc, url) { var pagesRe = new RegExp(/(\d+)( pages)/); var pagesMatch = pagesRe.exec(pages); if (pagesMatch!=null) { - newItem.pages = pagesMatch[1]; + newItem.numPages = pagesMatch[1]; } else { - newItem.pages = pages; + newItem.numPages = pages; } var ISBN; diff --git a/translators/MARC.js b/translators/MARC.js index f4db31a3ce..e2b1a07d74 100644 --- a/translators/MARC.js +++ b/translators/MARC.js @@ -8,7 +8,7 @@ "maxVersion":"", "priority":100, "inRepository":true, - "lastUpdated":"2008-06-29 21:10:00" + "lastUpdated":"2010-01-12 11:50:00" } function detectImport() { @@ -337,7 +337,7 @@ record.prototype.translate = function(item) { // Extract year this._associateDBField(item, "260", "c", "date", pullNumber); // Extract pages - this._associateDBField(item, "300", "a", "pages", pullNumber); + this._associateDBField(item, "300", "a", "numPages", pullNumber); // Extract series this._associateDBField(item, "440", "a", "series"); // Extract series number