diff --git a/CHANGES b/CHANGELOG.md similarity index 78% rename from CHANGES rename to CHANGELOG.md index dfdec93..19c26c5 100644 --- a/CHANGES +++ b/CHANGELOG.md @@ -1,12 +1,23 @@ -= 0.8.2 / 17 Mar 2014 +1.0.0 / 20 Dec 2014 +=================== + + * Inline tag compilation, by @mjackson. + * Fixed AMD registration, volo package.json entry, by @jrburke. + * Added spm support, by @afc163. + * Only access properties of objects on Context.lookup, by @cmbuckley. + +0.8.2 / 17 Mar 2014 +=================== * Supporting Bower through a bower.json file. -= 0.8.1 / 3 Jan 2014 +0.8.1 / 3 Jan 2014 +================== * Fix usage of partial templates. -= 0.8.0 / 2 Dec 2013 +0.8.0 / 2 Dec 2013 +================== * Remove compile* writer functions, use mustache.parse instead. Smaller API. * Throw an error when rendering a template that contains higher-order sections and @@ -15,7 +26,8 @@ * Better code readability and inline documentation. * Stop caching templates by name. -= 0.7.3 / 5 Nov 2013 +0.7.3 / 5 Nov 2013 +================== * Don't require the original template to be passed to the rendering function when using compiled templates. This is still required when using higher-order @@ -23,20 +35,23 @@ that was contained by that section. Fixes #262. * Performance improvements. -= 0.7.2 / 27 Dec 2012 +0.7.2 / 27 Dec 2012 +=================== * Fixed a rendering bug (#274) when using nested higher-order sections. * Better error reporting on failed parse. * Converted tests to use mocha instead of vows. -= 0.7.1 / 6 Dec 2012 +0.7.1 / 6 Dec 2012 +================== * Handle empty templates gracefully. Fixes #265, #267, and #270. * Cache partials by template, not by name. Fixes #257. * Added Mustache.compileTokens to compile the output of Mustache.parse. Fixes #258. -= 0.7.0 / 10 Sep 2012 +0.7.0 / 10 Sep 2012 +=================== * Rename Renderer => Writer. * Allow partials to be loaded dynamically using a callback (thanks @@ -50,7 +65,8 @@ @fallenice). * Don't use eval (thanks @cweider). -= 0.6.0 / 31 Aug 2012 +0.6.0 / 31 Aug 2012 +=================== * Use JavaScript's definition of falsy when determining whether to render an inverted section or not. Issue #186. diff --git a/bower.json b/bower.json index e8c9b11..53833fa 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "mustache.js", "main": "mustache.js", - "version": "0.8.2", + "version": "1.0.0", "homepage": "https://github.com/janl/mustache.js", "authors": [ "mustache.js Authors " diff --git a/mustache.js b/mustache.js index dbc9823..c7ffbef 100644 --- a/mustache.js +++ b/mustache.js @@ -525,7 +525,7 @@ }; mustache.name = "mustache.js"; - mustache.version = "0.8.2"; + mustache.version = "1.0.0"; mustache.tags = [ "{{", "}}" ]; // All high-level mustache.* functions use this writer. diff --git a/mustache.js.nuspec b/mustache.js.nuspec index 7a47994..a7f9a96 100644 --- a/mustache.js.nuspec +++ b/mustache.js.nuspec @@ -2,7 +2,7 @@ mustache.js - 0.8.2 + 1.0.0 mustache.js Authors https://github.com/janl/mustache.js/blob/master/LICENSE http://mustache.github.com/ diff --git a/mustache.min.js b/mustache.min.js new file mode 100644 index 0000000..5196f62 --- /dev/null +++ b/mustache.min.js @@ -0,0 +1 @@ +(function(global,factory){if(typeof exports==="object"&&exports){factory(exports)}else if(typeof define==="function"&&define.amd){define(["exports"],factory)}else{factory(global.Mustache={})}})(this,function(mustache){var Object_toString=Object.prototype.toString;var isArray=Array.isArray||function(object){return Object_toString.call(object)==="[object Array]"};function isFunction(object){return typeof object==="function"}function escapeRegExp(string){return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var RegExp_test=RegExp.prototype.test;function testRegExp(re,string){return RegExp_test.call(re,string)}var nonSpaceRe=/\S/;function isWhitespace(string){return!testRegExp(nonSpaceRe,string)}var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function escapeHtml(string){return String(string).replace(/[&<>"'\/]/g,function(s){return entityMap[s]})}var whiteRe=/\s*/;var spaceRe=/\s+/;var equalsRe=/\s*=/;var curlyRe=/\s*\}/;var tagRe=/#|\^|\/|>|\{|&|=|!/;function parseTemplate(template,tags){if(!template)return[];var sections=[];var tokens=[];var spaces=[];var hasTag=false;var nonSpace=false;function stripSpace(){if(hasTag&&!nonSpace){while(spaces.length)delete tokens[spaces.pop()]}else{spaces=[]}hasTag=false;nonSpace=false}var openingTagRe,closingTagRe,closingCurlyRe;function compileTags(tags){if(typeof tags==="string")tags=tags.split(spaceRe,2);if(!isArray(tags)||tags.length!==2)throw new Error("Invalid tags: "+tags);openingTagRe=new RegExp(escapeRegExp(tags[0])+"\\s*");closingTagRe=new RegExp("\\s*"+escapeRegExp(tags[1]));closingCurlyRe=new RegExp("\\s*"+escapeRegExp("}"+tags[1]))}compileTags(tags||mustache.tags);var scanner=new Scanner(template);var start,type,value,chr,token,openSection;while(!scanner.eos()){start=scanner.pos;value=scanner.scanUntil(openingTagRe);if(value){for(var i=0,valueLength=value.length;i0?sections[sections.length-1][4]:nestedTokens;break;default:collector.push(token)}}return nestedTokens}function Scanner(string){this.string=string;this.tail=string;this.pos=0}Scanner.prototype.eos=function(){return this.tail===""};Scanner.prototype.scan=function(re){var match=this.tail.match(re);if(!match||match.index!==0)return"";var string=match[0];this.tail=this.tail.substring(string.length);this.pos+=string.length;return string};Scanner.prototype.scanUntil=function(re){var index=this.tail.search(re),match;switch(index){case-1:match=this.tail;this.tail="";break;case 0:match="";break;default:match=this.tail.substring(0,index);this.tail=this.tail.substring(index)}this.pos+=match.length;return match};function Context(view,parentContext){this.view=view==null?{}:view;this.cache={".":this.view};this.parent=parentContext}Context.prototype.push=function(view){return new Context(view,this)};Context.prototype.lookup=function(name){var cache=this.cache;var value;if(name in cache){value=cache[name]}else{var context=this,names,index;while(context){if(name.indexOf(".")>0){value=context.view;names=name.split(".");index=0;while(value!=null&&index":if(!partials)continue;value=isFunction(partials)?partials(token[1]):partials[token[1]];if(value!=null)buffer+=this.renderTokens(this.parse(value),context,partials,value);break;case"&":value=context.lookup(token[1]);if(value!=null)buffer+=value;break;case"name":value=context.lookup(token[1]);if(value!=null)buffer+=mustache.escape(value);break;case"text":buffer+=token[1];break}}return buffer};mustache.name="mustache.js";mustache.version="1.0.0";mustache.tags=["{{","}}"];var defaultWriter=new Writer;mustache.clearCache=function(){return defaultWriter.clearCache()};mustache.parse=function(template,tags){return defaultWriter.parse(template,tags)};mustache.render=function(template,view,partials){return defaultWriter.render(template,view,partials)};mustache.to_html=function(template,view,partials,send){var result=mustache.render(template,view,partials);if(isFunction(send)){send(result)}else{return result}};mustache.escape=escapeHtml;mustache.Scanner=Scanner;mustache.Context=Context;mustache.Writer=Writer}); \ No newline at end of file diff --git a/package.json b/package.json index e3ef7f0..408ee9d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mustache", - "version": "0.8.2", + "version": "1.0.0", "description": "Logic-less {{mustache}} templates with JavaScript", "author": "mustache.js Authors ", "repository": {