Created
June 8, 2014 23:30
-
-
Save msaby/334371be1a11f50b739c to your computer and use it in GitHub Desktop.
Zotero translator for the BBF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"translatorID": "19f2674b-b2ee-4436-af1b-9982011299dd", | |
"label": "BBF", | |
"creator": "Mathieu Saby", | |
"target": "^https?://bbf\\.enssib.fr", | |
"minVersion": "3.0", | |
"maxVersion": "", | |
"priority": 100, | |
"inRepository": true, | |
"translatorType": 4, | |
"browserSupport": "gcsib", | |
"lastUpdated": "2014-06-09 01:26:05" | |
} | |
/* | |
Translator for the Bulletin des Bibliothèques de France | |
Copyright (C) 2014 Mathieu Saby | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU Affero General Public License as published by | |
the Free Software Foundation, either version 3 of the License, or | |
(at your option) any later version. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of | |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
GNU Affero General Public License for more details. | |
You should have received a copy of the GNU Affero General Public License | |
along with this program. If not, see <http://www.gnu.org/licenses/>. | |
*/ | |
function detectWeb(doc,url) { | |
if ((url.indexOf("bbf.enssib.fr/consulter/") != -1)){ | |
return "journalArticle"; | |
} | |
return false ; | |
} | |
function doWeb(doc,url) | |
{ | |
if (detectWeb(doc, url) == "journalArticle") { | |
// force itemtype to be journalArticle | |
// get no of issue from URL : http://bbf.enssib.fr/consulter/bbf-1957-02-0124-001 -> 02 | |
// adds the publication title : "Bulletin des bibliothèques de France" | |
var publicationname = "Bulletin des bibliothèques de France"; | |
var issn = "1292-8399"; | |
// 1292-8399 is the e-ISSN. The ISSN of the print version is 0006-2006 | |
var issue = ""; | |
var matchissue = []; | |
matchissue = url.match(/^.*\/bbf-\d\d\d\d-(\d\d)/); | |
if (matchissue.length > 1 ) { | |
issue = matchissue [1]; | |
} | |
var translator = Zotero.loadTranslator("import"); | |
translator.setTranslator("951c027d-74ac-47d4-a107-9c3069ab7b48"); | |
translator.setHandler("itemDone", function(obj, item) { | |
item.itemType = "journalArticle"; | |
item.publicationTitle = publicationname; | |
item.issue = issue; | |
item.ISSN = issn; | |
item.complete(); | |
}); | |
translator.getTranslatorObject(function (obj) { | |
obj.doWeb(doc, url); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment