Browse files

change escaping '\r' and '\t'

  • Loading branch information...
1 parent 0ca521c commit 3fa9856d0a2895d117a93f7dddbd9739f0a756bd @tasogarepg committed Jul 17, 2012
Showing with 4 additions and 4 deletions.
  1. +2 −2 lib/node-pages.js
  2. +2 −2 test/node-pages.test.js
View
4 lib/node-pages.js
@@ -125,8 +125,8 @@ Pages.prototype.parse = function(src) {
str = src.substring(start, end).
replace(/\\/g, '\\\\').
replace(/'/g, "\\'").
- replace(/\t/g, ' ').
- replace(/\r/g, '').
+ replace(/\t/g, '\\t').
+ replace(/\r/g, '\\r').
replace(/\n/g, '\\n');
if (str != '') {
buf += " renderStr += '" + str + "';\n";
View
4 test/node-pages.test.js
@@ -67,15 +67,15 @@ describe('node-pages', function() {
pages = Pages.newInstance({
srcPath : templateFile
});
- assert.equal(pages.render(), ' ');
+ assert.equal(pages.render(), '\t');
});
it('output \\r', function() {
fs.writeFileSync(templateFile, '\r');
pages = Pages.newInstance({
srcPath : templateFile
});
- assert.equal(pages.render(), '');
+ assert.equal(pages.render(), '\r');
});
it('output \\n', function() {

0 comments on commit 3fa9856

Please sign in to comment.