Skip to content

Commit

Permalink
Bugfix, escaping in template was completely mad
Browse files Browse the repository at this point in the history
  • Loading branch information
vanng822 committed May 31, 2014
1 parent abaeb0f commit f763f23
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
10 changes: 7 additions & 3 deletions lib/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,15 @@ exports.module = function(pagination, util) {
return buf.join('');
};
var _escape = function(text) {
return String(text).replace(/&(?!\w+;)/g, '&amp;').replace(/</g, '&lt;')
.replace(/>/g, '&gt;').replace(/"/g, '&quot;');
return String(text)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;');
};
var _compile = function(str, options) {
var fn = new Function('paginationData', parse(str, options));
var fn = new Function('paginationData, escape', parse(str, options));
return function(paginationData){
return fn.call(this, paginationData, _escape);
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"type": "git",
"url": "git://github.com/vanng822/pagination.git"
},
"version": "0.4.1",
"version": "0.4.2",
"scripts": {
"test": "vows --spec tests/*"
},
Expand Down
2 changes: 1 addition & 1 deletion release/pagination.et.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f763f23

Please sign in to comment.