Strict escape IItags/0.5.2
| @@ -86,11 +86,12 @@ var Mustache = (typeof module !== "undefined" && module.exports) || {}; | |||||
| "<": "<", | "<": "<", | ||||
| ">": ">", | ">": ">", | ||||
| '"': '"', | '"': '"', | ||||
| "'": ''' | |||||
| "'": ''', | |||||
| "/": '/' | |||||
| }; | }; | ||||
| function escapeHTML(string) { | function escapeHTML(string) { | ||||
| return String(string).replace(/&(?!\w+;)|[<>"']/g, function (s) { | |||||
| return String(string).replace(/[&<>"'\/]/g, function (s) { | |||||
| return escapeMap[s] || s; | return escapeMap[s] || s; | ||||
| }); | }); | ||||
| } | } | ||||
| @@ -7,8 +7,8 @@ var dot_notation = { | |||||
| return this.value * 0.2; | return this.value * 0.2; | ||||
| }, | }, | ||||
| currency: { | currency: { | ||||
| symbol: '€', | |||||
| name: 'Euro' | |||||
| symbol: '$', | |||||
| name: 'USD' | |||||
| } | } | ||||
| }, | }, | ||||
| availability:{ | availability:{ | ||||
| @@ -1,8 +1,8 @@ | |||||
| <!-- exciting part --> | <!-- exciting part --> | ||||
| <h1>A Book</h1> | <h1>A Book</h1> | ||||
| <p>Authors: <ul><li>John Power</li><li>Jamie Walsh</li></ul></p> | <p>Authors: <ul><li>John Power</li><li>Jamie Walsh</li></ul></p> | ||||
| <p>Price: €200 Euro <b>In Stock</b></p> | |||||
| <p>VAT: €40</p> | |||||
| <p>Price: $200 USD <b>In Stock</b></p> | |||||
| <p>VAT: $40</p> | |||||
| <!-- boring part --> | <!-- boring part --> | ||||
| <h2>Test truthy false values:</h2> | <h2>Test truthy false values:</h2> | ||||
| <p>Zero: 0</p> | <p>Zero: 0</p> | ||||
| @@ -2,5 +2,5 @@ var escaped = { | |||||
| title: function() { | title: function() { | ||||
| return "Bear > Shark"; | return "Bear > Shark"; | ||||
| }, | }, | ||||
| entities: """ | |||||
| entities: "" \"'<>/" | |||||
| }; | }; | ||||
| @@ -1,2 +1,2 @@ | |||||
| <h1>Bear > Shark</h1> | <h1>Bear > Shark</h1> | ||||
| But not ". | |||||
| But not &quot; "'<>/. | |||||