commit 8225c417ddec8bfbe56d03071fe703e041e86e55
parent cbc6d58e8ee0602fc2df82b43544774f04cb117e
Author: Avram Lyon <ajlyon@gmail.com>
Date: Sun, 6 Jun 2010 23:20:52 +0000
New version of CSA translator, per discussion at http://forums.zotero.org/discussion/11969
Diffstat:
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/translators/Cambridge Scientific Abstracts.js b/translators/Cambridge Scientific Abstracts.js
@@ -8,9 +8,14 @@
"maxVersion":"",
"priority":100,
"inRepository":true,
- "lastUpdated":"2008-05-28 18:30:00"
+ "lastUpdated":"2010-06-06 18:30:00"
}
+/* Provides support for databases of Cambridge Scientific Abstracts
+ Tested with CSA Illumina, http://www.csa.com/
+ CSA does not provide stable URLs
+ */
+
function detectWeb(doc, url) {
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
@@ -115,9 +120,16 @@ function scrape(doc) {
newItem.publisher = m[2];
}
} else if(itemType == "bookSection") {
- if(content.length > newItem.publicationTitle.length
- && content.substr(0, newItem.publicationTitle.length) == newItem.publicationTitle) {
- var m = content.match(/\)\. ([^:]+): ([^,0-9]+)/);
+ if((content.length > newItem.publicationTitle.length
+ && content.substr(0, newItem.publicationTitle.length) == newItem.publicationTitle)
+ || content.indexOf(newItem.publicationTitle)) {
+ if (content.indexOf(newItem.publicationTitle) > 4) {
+ // This means we probably have a book author or editor first
+ var m = content.match(/^([^\.]+)\./);
+ if (m) newItem.creators.push(
+ Zotero.Utilities.cleanAuthor(m[1], "bookAuthor", true));
+ }
+ var m = content.match(/\)\. ([^:()]+): ([^,0-9]+)/);
if(m) {
newItem.place = m[1];
newItem.publisher = m[2];
@@ -154,6 +166,10 @@ function scrape(doc) {
if(newItem.itemType == "thesis") {
newItem.publisher = content;
}
+ } else if(heading == "pages") { // This is for book sections
+ newItem.pages = content;
+ } else if(heading == "language") {
+ newItem.language = content;
}
}
@@ -184,4 +200,4 @@ function doWeb(doc, url) {
} else {
scrape(doc);
}
-}
-\ No newline at end of file
+}