zotero / scaffold

Zotero translator creation IDE
http://www.zotero.org/support/dev/scaffold
38 stars 9 forks source link

Add a new line before file ending when saving #37

Closed zuphilip closed 7 years ago

zuphilip commented 7 years ago

It looks that during saving a translator with Scaffold there is no new line at the file ending. However, files should end with a newline, as this is part of the POSIX standard and most tools as well as the editors will expect that. Actually, it is quite frequent that in commits for translators this difference shows up, e.g. most recent https://github.com/zotero/translators/commit/16e77e81c046c11abc9a6beea668a9eab5d2df74#diff-28f549f8b27210b22f79c52c0eac9d73L894 . HT @kba

newline

Can we change the saving in Scaffold such that it will also include a newline before the file ending?

dstillman commented 7 years ago

This will be in the next Zotero 5.0 beta, build 117.

zuphilip commented 7 years ago

Okay, that is good to hear. I don't know how scaffold and this zotero code is related exactly but we could also additionally correct this already on the scaffold level (there is no reason to systematically not doing it in scaffold). I would suggest to change these lines to:

- var code = "/** BEGIN TEST CASES **/\nvar testCases = "
+ var code = "\n/** BEGIN TEST CASES **/\nvar testCases = "
-   testString + "\n/** END TEST CASES **/";
+   testString + "\n/** END TEST CASES **/\n";

Also in the beginning there should be IMO a newline, because otherwise this is much more difficult to parse (e.g. in the travis check).

Can I prepare such a PR here?

dstillman commented 7 years ago

There's no point — Scaffold saves through Zotero, the code is already updated to only work with 5.0, and this is fixed for 5.0.

dstillman commented 7 years ago

Oh, didn't see the part about the beginning newline — we can fix that, then.