Ver código fonte

Add lint task using JSHint

tags/0.5.2
Michael Jackson 14 anos atrás
pai
commit
9079bd88f2
3 arquivos alterados com 21 adições e 7 exclusões
  1. +5
    -0
      .jshintrc
  2. +5
    -0
      Rakefile
  3. +11
    -7
      mustache.js

+ 5
- 0
.jshintrc Ver arquivo

@@ -0,0 +1,5 @@
{
"eqnull": true,
"evil": true
}


+ 5
- 0
Rakefile Ver arquivo

@@ -25,6 +25,11 @@ task :minify do
sh "uglifyjs mustache.js > #{minified_file}"
end

desc "Run JSHint, requires jshint (see http://www.jshint.com)"
task :lint do
sh "jshint mustache.js"
end

# Creates a task that uses the various template wrappers to make a wrapped
# output file. There is some extra complexity because Dojo and YUI use
# different final locations.


+ 11
- 7
mustache.js Ver arquivo

@@ -64,7 +64,7 @@ var Mustache = (typeof module !== "undefined" && module.exports) || {};
}

function escapeRe(string) {
return string.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
}

var entityMap = {
@@ -243,21 +243,25 @@ var Mustache = (typeof module !== "undefined" && module.exports) || {};
case "object":
if (isArray(value)) {
var buffer = "";

for (var i = 0, len = value.length; i < len; ++i) {
buffer += callback(context.push(value[i]), this);
}

return buffer;
} else {
return callback(context.push(value), this);
}
break;

return callback(context.push(value), this);
case "function":
var sectionText = callback(context, this), self = this;
// TODO: The text should be passed to the callback plain, not rendered.
var sectionText = callback(context, this),
self = this;

var scopedRender = function (template) {
return self.render(template, context);
};

return value.call(context.view, sectionText, scopedRender) || "";
break;
default:
if (value) {
return callback(context, this);
@@ -549,7 +553,7 @@ var Mustache = (typeof module !== "undefined" && module.exports) || {};

// The high-level clearCache, compile, compilePartial, and render functions
// use this default renderer.
var _renderer = new Renderer;
var _renderer = new Renderer();

/**
* Clears all cached templates and partials.


Carregando…
Cancelar
Salvar