sustrik / ribosome

Simple code generator
248 stars 21 forks source link

Support \r\n line endings with nodejs #33

Closed qbradley closed 9 years ago

qbradley commented 9 years ago

On Windows, gvim and notepad create text files with \r\n line endings instead of \n. The nodejs implementation splits the file based on \n leaving the \r behind. These \r can be inside of generated strings, causing the generated javascript to fail to parse.

The solution is to use regular express /\r?\n/ to split the string.

I examined the python and ruby implementations, but I do not believe they have the same problem since they are using "readline" and "gets" api respectively, which should handle both line endings.

sustrik commented 9 years ago

Can you please state that the patch is submitted under MIT license?

qbradley commented 9 years ago

This patch is submitted under MIT license.