diff --git a/.gitignore b/.gitignore index c44d96c..65128cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +# ignore temp vim files +*.swp .DS_Store .rvmrc runner.js diff --git a/TESTING.md b/TESTING.md index 6abec93..0be439b 100644 --- a/TESTING.md +++ b/TESTING.md @@ -1,5 +1,7 @@ ## Running the mustache.js Test Suite +Notice: the tests are only expected to run on unixoid systems. + The mustache.js test suite uses the [RSpec](http://rspec.info/) testing framework. In order to run the tests you'll need to install [Ruby](http://ruby-lang.org/) as well as the `rake`, `rspec` (>=2), and `json` [RubyGems](http://rubygems.org/). @@ -34,6 +36,17 @@ Install the required gems: That's it! +### How to install node.js from source + + $ git clone https://github.com/joyent/node.git + $ cd node + $ # select the version to install, master is unstable; + $ # latest stable version is advertised on http://nodejs.org + $ git checkout v0.6.11 + $ ./configure + $ make + $ sudo make install + ### How to run the tests The mustache.js test suite currently uses 4 different JavaScript runtime engines diff --git a/mustache.js b/mustache.js index 929f397..6259024 100644 --- a/mustache.js +++ b/mustache.js @@ -40,11 +40,11 @@ var Mustache = function () { "<": "<", ">": ">", '"': '"', - "'": ''' + "'": ''' }; function escapeHTML(string) { - return String(string).replace(/&(?!\w+;)|[<>"']/g, function (s) { + return String(string).replace(/&(?!#?\w+;)|[<>"']/g, function (s) { return escapeMap[s] || s; }); } diff --git a/spec/_files/escaped.js b/spec/_files/escaped.js index 7a8baef..875776a 100644 --- a/spec/_files/escaped.js +++ b/spec/_files/escaped.js @@ -2,5 +2,6 @@ var escaped = { title: function() { return "Bear > Shark"; }, + subtitle: 'Rock 'n Roll', entities: """ }; diff --git a/spec/_files/escaped.mustache b/spec/_files/escaped.mustache index ea25951..b8f82d0 100644 --- a/spec/_files/escaped.mustache +++ b/spec/_files/escaped.mustache @@ -1,2 +1,3 @@