Преглед изворни кода

Merge pull request #169 from eric-brechemier/maintenance

Maintenance - Fixes for escaping of apostrophe
tags/0.4.1
Jan Lehnardt пре 14 година
родитељ
комит
3abcd5bb91
6 измењених фајлова са 20 додато и 2 уклоњено
  1. +2
    -0
      .gitignore
  2. +13
    -0
      TESTING.md
  3. +2
    -2
      mustache.js
  4. +1
    -0
      spec/_files/escaped.js
  5. +1
    -0
      spec/_files/escaped.mustache
  6. +1
    -0
      spec/_files/escaped.txt

+ 2
- 0
.gitignore Прегледај датотеку

@@ -1,3 +1,5 @@
# ignore temp vim files
*.swp
.DS_Store
.rvmrc
runner.js


+ 13
- 0
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


+ 2
- 2
mustache.js Прегледај датотеку

@@ -40,11 +40,11 @@ var Mustache = function () {
"<": "&lt;",
">": "&gt;",
'"': '&quot;',
"'": '&apos;'
"'": '&#39;'
};

function escapeHTML(string) {
return String(string).replace(/&(?!\w+;)|[<>"']/g, function (s) {
return String(string).replace(/&(?!#?\w+;)|[<>"']/g, function (s) {
return escapeMap[s] || s;
});
}


+ 1
- 0
spec/_files/escaped.js Прегледај датотеку

@@ -2,5 +2,6 @@ var escaped = {
title: function() {
return "Bear > Shark";
},
subtitle: 'Rock &#39;n Roll',
entities: "&quot;"
};

+ 1
- 0
spec/_files/escaped.mustache Прегледај датотеку

@@ -1,2 +1,3 @@
<h1>{{title}}</h1>
<h2>{{subtitle}}</h2>
But not {{entities}}.

+ 1
- 0
spec/_files/escaped.txt Прегледај датотеку

@@ -1,2 +1,3 @@
<h1>Bear &gt; Shark</h1>
<h2>Rock &#39;n Roll</h2>
But not &quot;.

Loading…
Откажи
Сачувај