Convert Zotero fields in Extra to CSL fields for citeproc-js

This commit is contained in:
Dan Stillman 2020-03-02 01:35:08 -05:00
parent 83cc65eea6
commit da5e8c549e
3 changed files with 46 additions and 2 deletions

View file

@ -23,5 +23,23 @@ describe("Zotero.Cite", function () {
+ 'This is just some text.';
assert.equal(Zotero.Cite.extraToCSL(str1), str2);
});
it("should convert Zotero field names to CSL fields", function () {
var str1 = 'publicationTitle: My Publication';
var str2 = 'container-title: My Publication';
assert.equal(Zotero.Cite.extraToCSL(str1), str2);
});
it("should convert capitalized and spaced Zotero field names to CSL fields", function () {
var str1 = 'Publication Title: My Publication\nDate: 1989';
var str2 = 'container-title: My Publication\nissued: 1989';
assert.equal(Zotero.Cite.extraToCSL(str1), str2);
});
it("should convert lowercase 'doi' to uppercase", function () {
var str1 = 'doi: 10.0/abc';
var str2 = 'DOI: 10.0/abc';
assert.equal(Zotero.Cite.extraToCSL(str1), str2);
});
});
});