Permalink
Browse files

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

  • Loading branch information...
1 parent b8c5969 commit 8291f52ac986884425d85cd6c20c13578ba8df88 @mschwartz committed Jun 8, 2012
Showing with 9 additions and 8 deletions.
  1. +9 −8 lib/Jst.js
View
@@ -89,18 +89,18 @@ 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>');
res.write('<pre>');
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('');

0 comments on commit 8291f52

Please sign in to comment.