diff --git a/mustache.js b/mustache.js index 0fef360..c5be0c9 100644 --- a/mustache.js +++ b/mustache.js @@ -63,7 +63,7 @@ var Mustache = (typeof module !== "undefined" && module.exports) || {}; }; function escapeHtml(string) { - return String(string).replace(/&(?!\w+;)|[<>"']/g, function (s) { + return String(string).replace(/[&<>"']/g, function (s) { return entityMap[s]; }); } diff --git a/test/_files/dot_notation.mustache b/test/_files/dot_notation.mustache index 138ddd0..f89d70b 100644 --- a/test/_files/dot_notation.mustache +++ b/test/_files/dot_notation.mustache @@ -1,8 +1,8 @@
Authors:
Price: {{price.currency.symbol}}{{price.value}} {{#price.currency}}{{name}} {{availability.text}}{{/price.currency}}
-VAT: {{price.currency.symbol}}{{#price}}{{vat}}{{/price}}
+Price: {{{price.currency.symbol}}}{{price.value}} {{#price.currency}}{{name}} {{availability.text}}{{/price.currency}}
+VAT: {{{price.currency.symbol}}}{{#price}}{{vat}}{{/price}}
Zero: {{truthy.zero}}
diff --git a/test/_files/escaped.mustache b/test/_files/escaped.mustache index ea25951..93e800b 100644 --- a/test/_files/escaped.mustache +++ b/test/_files/escaped.mustache @@ -1,2 +1,2 @@