Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added format() method, which returns pretty printable JSON.

  • Loading branch information...
commit 8291f52ac986884425d85cd6c20c13578ba8df88 1 parent b8c5969
Michael Schwartz authored
Showing with 9 additions and 8 deletions.
  1. +9 −8 lib/Jst.js
17 lib/Jst.js
View
@@ -89,7 +89,7 @@ var Jst = {
res.reset();
res.write('<h1>Template Error</h1>');
res.write('<pre>');
- res.write(e+ '\n');
+ // res.write(e+ '\n');
res.write(e.stack);
res.write('</pre>');
res.write('<h2>Compiled Template</h2>');
@@ -97,10 +97,10 @@ var Jst = {
var lineNo = 1;
forEach(code.split('\n'), function(line) {
if (lineNo == e.lineNumber) {
- res.write(sprintf("<b>%4d %s</b>\n", lineNo++, line.replace(/</, '&lt;')));
+ res.write(sprintf("<b>%4d %s</b>\n", lineNo++, line.replace(/</g, '&lt;')));
}
else {
- res.write(sprintf("%4d %s\n", lineNo++, line.replace(/</, '&lt;')));
+ res.write(sprintf("%4d %s\n", lineNo++, line.replace(/</g, '&lt;')));
}
});
res.write('</pre>');
@@ -394,11 +394,12 @@ var Jst = {
eval(parsed);
}
catch (e) {
- console.dir(e);
- console.log(e.stack);
- console.dir(parsed);
- console.dir(e);
- console.log(e.stack);
+ Jst.evalError(e, parsed);
+ // console.dir(e);
+ // console.log(e.stack);
+ // console.dir(parsed);
+ // console.dir(e);
+ // console.log(e.stack);
}
}
return jst_html.join('');
Please sign in to comment.
Something went wrong with that request. Please try again.