creationix/haml-js — pull request #50 by ilich (2011-11-19 12:48:41+00:00)
Title: Fixed escaper initialization issue

Hi Tim,

Thank you for the great project. It is really useful and saved me a lot of time.

Yesterday I found an issue with Haml.render function. For example, if you have a document:
!!!
%html
%head
$title&= title

Then you tries to call Haml.render(doc, { locals: { title: "The test" } }); The call fails with the error of undefined function.

The issue is &= title converted to undefined(title) call what is wrong. I modified the code to initialize escaper function in the render method as well. It has been initialized only in Haml(haml, config) function before.

The second change was to fix how you process end of line characters on Windows. Unit had tests because they expected to have \r\n in a rendered content but there were just \n or \n\n. I fixed the issue: if the platform is Windows then use \r\n otherwise just \n.

I also added a possibility to run only selected tests. For example, node tests.js comments.haml.

I changed deprecated module 'sys' with 'utils' in the tests.js

Please let me know if you have questions or concerns. Otherwise please merge them to the main branch.

Best regards,
Ilya