Skip to content

Instantly share code, notes, and snippets.

@matschaffer
Created October 2, 2009 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matschaffer/199998 to your computer and use it in GitHub Desktop.
Save matschaffer/199998 to your computer and use it in GitHub Desktop.
js> load('ejs.js')
js> ;
js> var world="world";
js> var template='hello <%= world %>';
js> print(template);
hello <%= world %>
js> var compiler = EjsCompiler(source);
js: "<stdin>", line 7: uncaught JavaScript runtime exception: ReferenceError: "source" is not defined.
at <stdin>:7
js> var compiler = EjsCompiler(template);
js> print(compiler.compile());
js: "<stdin>", line 9: uncaught JavaScript runtime exception: TypeError: Cannot call method "compile" of undefined
at <stdin>:9
js> var compiler = new EjsCompiler(template);
js> print(compiler.compile());
undefined
js> print(compiler.out);
___ejsO = "";; ___ejsO += "hello "; ___ejsO += (EjsScanner.to_text( world ));
js> eval(compiler.out);
hello world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment