Skip to content

Commit

Permalink
change escaping '\r' and '\t'
Browse files Browse the repository at this point in the history
  • Loading branch information
tasogarepg committed Jul 17, 2012
1 parent 0ca521c commit 3fa9856
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/node-pages.js
Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions test/node-pages.test.js
Expand Up @@ -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() {
Expand Down

0 comments on commit 3fa9856

Please sign in to comment.