www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit cddc84ffe33e6b03bdb805f4d45a6353a4ef32d3
parent c9694e93b02ea3bec41fb17d258b5b69a43a8186
Author: Dan Stillman <dstillman@zotero.org>
Date:   Mon, 23 Jan 2017 05:57:18 -0500

Make sure translator file ends with newline when saving

Fixes https://github.com/zotero/scaffold/issues/37

Diffstat:
Mchrome/content/zotero/xpcom/translation/translators.js | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/xpcom/translation/translators.js b/chrome/content/zotero/xpcom/translation/translators.js @@ -475,8 +475,12 @@ Zotero.Translators = new function() { // JSON.stringify has the benefit of indenting JSON var metadataJSON = JSON.stringify(metadata, null, "\t"); - var str = metadataJSON + "\n\n" + code, - translator; + var str = metadataJSON + "\n\n" + code; + + // Make sure file ends with newline + if (!str.endsWith('\n')) { + str += '\n'; + } var translator = Zotero.Translators.get(metadata.translatorID); var sameFile = translator && destFile == translator.path;