From c84a16984b80b0a7d44f1ad835f47eab86f1f36d Mon Sep 17 00:00:00 2001 From: Aurimas Vinckevicius Date: Tue, 12 May 2015 18:36:27 -0500 Subject: [PATCH] Map note excerpt to title in itemToCSLJSON This way notes have some sort of user-friendly way of being traced from Word documents to Zotero items in the library --- chrome/content/zotero/xpcom/utilities.js | 5 +++++ test/tests/utilities.js | 1 + 2 files changed, 6 insertions(+) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 8ee2cec4a..320493026 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -1597,6 +1597,11 @@ Zotero.Utilities = { } } + // Special mapping for note title + if (zoteroItem.itemType == 'note' && zoteroItem.note) { + cslItem.title = Zotero.Notes.noteToTitle(zoteroItem.note); + } + // extract PMID var extra = zoteroItem.extra; if(typeof extra === "string") { diff --git a/test/tests/utilities.js b/test/tests/utilities.js index 55fcb4e91..4e2d7179c 100644 --- a/test/tests/utilities.js +++ b/test/tests/utilities.js @@ -207,6 +207,7 @@ describe("Zotero.Utilities", function() { let cslJSONNote = Zotero.Utilities.itemToCSLJSON(note); assert.equal(cslJSONNote.type, 'article', 'note is exported as "article"'); + assert.equal(cslJSONNote.title, note.getNoteTitle(), 'note title is set to Zotero pseudo-title'); }); it("should convert standalone attachments to expected format", function() { let file = getTestDataDirectory();