Skip to content

Commit

Permalink
prep for release
Browse files Browse the repository at this point in the history
  • Loading branch information
jlongster committed Sep 30, 2014
1 parent da13ddc commit 2b6cea6
Show file tree
Hide file tree
Showing 7 changed files with 322 additions and 312 deletions.
104 changes: 2 additions & 102 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,103 +1,3 @@
Changelog for versions previous to v0.1.9 are located at http://nunjucks.tumblr.com/.
Changelog is available at https://github.com/mozilla/nunjucks/releases

# v1.0.6 (August 15, 2014)

* Added the `addGlobal` method to the Environment object
* import/extends/include now can take an arbitrary expression
* fix bugs in `set`
* improve express integration (allows rendering templates without an extension)

# v1.0.5 (May 1, 2014)

* Added support for browserify
* Added option to specify template output path when precompiling templates
* Keep version comment in browser minified files
* Speed up SafeString implementation
* Handle null and non-matching cases for word count filter
* Added support for node-webkit
* Other various minor bugfixes

# v1.0.4 (April 4, 2014)

* Use v0.8.2 of chokidar from NPM rather than Github

# v1.0.2 (March 25, 2014)

* Use chokidar for watching file changes. This should fix a lot of problems on OS X machines.
* Always use `/` in paths when precompiling templates
* Fix bug where async filters hang indefinitely inside `if` statements
* Extensions now can override autoescaping with an `autoescape` property
* Other various minor bugfixes

# v1.0.1 (December 16, 2013)

This is mostly bugfix and code cleanup release. The only added things are:

* New `nunjucks.compile` function which takes a string and returns a `Template` object
* The `urlize` filter has been added

# v1.0.0 (October 24, 2013)

We've hit 1.0! Thanks for helping nunjucks stabilize and become
awesome. I've added many good features recently and several people
have been using them, and everything seems stable. I think it's time
to cut 1.0.

## Big changes:

* An asynchronous API is now available, and async filters, extensions, and
loaders is supported. The async API is optional and if you don't do
anything async (the default), nothing changes for you. You can read
more about this
[here](http://jlongster.github.io/nunjucks/api.html#asynchronous-support). (fixes #41)
* Much simpler higher-level API for initiating/configuring nunjucks is
available. Read more
[here](http://jlongster.github.io/nunjucks/api.html#simple-api).
* An official grunt plugin is available for precompiling templates: [grunt-nunjucks](https://github.com/jlongster/grunt-nunjucks)
* **The browser files have been renamed**. nunjucks.js is now the full
library with compiler, and nunjucks-slim.js is the small version
that only works with precompiled templates

## Smaller changes:

* urlencode filter has been added
* The express integration has been refactored and isn't a kludge
anymore. Should avoid some bugs and be more future-proof;
* The order in which variables are lookup up in the context and frame
lookup has been reversed. It will now look in the frame first, and
then the context. This means that if a `for` loop introduces a new
var, like `{% for name in names %}`, and if you have `name` in the
context as well, it will properly reference `name` from the for loop
inside the loop. (fixes #122 and #119)

# v0.1.10 (August 9, 2013)

This is a minor version update that includes several bugfixes.

* fix hang when parsing an unclosed string that hits the end of file (fixes #85)
* Adds IE8 support
* `super()` calls are marked safe by default if using autoescaping
* exposed a `markSafe` function in the runtime module for marking strings as safe inside filters
* iterating over any "falsey" values will output nothing
* make "this" be the context object in filters (fixes #109)

# v0.1.9 (May 31, 2013)

* autoescaping ([docs](http://nunjucks.jlongster.com/api#Autoescaping))
* support for custom tags ([docs](http://nunjucks.jlongster.com/api#Custom-Tags-%2526-Extensions))
* the API for the `Environment` object changed slightly ([docs](http://nunjucks.jlongster.com/api#new-Environment%28%255Bloaders%255D%252C-%255Boptions%255D%29))
* tests now use expect.js instead of should.js, can be run [in the browser](http://jlongster.github.io/nunjucks/tests/browser/)!
* ternary conditional operator added (foo if bar else baz)
* various optimizations, compilation is now 1.4x faster
* fix too aggressive caching of templates from HTTP loader
* truncate filter has been added
* improve title filter
* many improvements to error messages
* add AMD support for precompiled templates
* fix multiple levels of super (issue #61)
* support passing a single file to nunjucks-precompile
* fix usage of `set` in an `if` block
* fixed passing a false-y value as the last argument to a macro
* `range`, `cycler`, and `joiner` globals have been added
* fix nested blocks
* add bower.json so the client-side lib can be installed through bower
For versions previous to v0.1.9 are located at http://nunjucks.tumblr.com/.
16 changes: 8 additions & 8 deletions MAINTENANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,33 @@ Nunjucks attempts to adhere to semantic versioning. The API is very stable, so f

1. Do a `pull` from github to make sure you have all the latest updates

2. View all the changes and update CHANGELOG.md:
2. View all the changes since the last version:

```
$ git log --oneline v1.2.3..master
```

Replace `v1.2.3` with whatever the last version was, and you'll see all the changes going out in this version. Add a new version to CHANGELOG.md and write some notes about what's going out.
Replace `v1.2.3` with whatever the last version was, and you'll see all the changes going out in this version.

3. Update the version in `package.json`
3. Draft a new release and write the changelog in the description, describing the changes in see from #2. The title should be the version.

4. Run the command to make sure the ready-made files for the browser are up-to-date.

```
$ make browserfiles
```

5. Commit above changes and push to `master`
5. Update the version in `package.json`

6. Publish to npm:
6. Commit above changes and push to `master`

7. Publish to npm:

```
npm publish
```

7. Go to https://github.com/mozilla/nunjucks/releases and click "Draft a new release". Fill out title and copy what you entered in CHANGELOG.md in the description. (CHANGELOG.md could go away I guess with github's release stuff)

8. Make sure docs are up-to-date. If anything, you need to copy all the nunjucks*.js files in `browser/` to the [nunjucks-docs repo](https://github.com/mozilla/nunjucks-docs) in the `files` directory. This is where the "download" link points to in the docs. In `nunjucks-docs`, build the docs:
8. Make sure docs are up-to-date. You need to at least copy all the nunjucks*.js files in `browser/` to the [nunjucks-docs repo](https://github.com/mozilla/nunjucks-docs) in the `files` directory. This is where the "download" link points to in the docs. In `nunjucks-docs`, build the docs:

```
cd path/to/nunjucks-docs && make prod
Expand Down
80 changes: 41 additions & 39 deletions browser/nunjucks-slim.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Browser bundle of nunjucks 1.0.7 (slim, only works with precompiled templates)
// Browser bundle of nunjucks 1.1.0 (slim, only works with precompiled templates)

(function() {
var modules = {};
Expand Down Expand Up @@ -198,7 +198,7 @@ exports.without = function(array) {
contains = exports.toArray(arguments).slice(1);

while(++index < length) {
if(contains.indexOf(array[index]) === -1) {
if(exports.indexOf(contains, array[index]) === -1) {
result.push(array[index]);
}
}
Expand Down Expand Up @@ -293,37 +293,35 @@ exports.asyncFor = function(obj, iter, cb) {
next();
};

if(!Array.prototype.indexOf) {
Array.prototype.indexOf = function(array, searchElement /*, fromIndex */) {
if (array == null) {
throw new TypeError();
}
var t = Object(array);
var len = t.length >>> 0;
if (len === 0) {
return -1;
}
var n = 0;
if (arguments.length > 2) {
n = Number(arguments[2]);
if (n != n) { // shortcut for verifying if it's NaN
n = 0;
} else if (n != 0 && n != Infinity && n != -Infinity) {
n = (n > 0 || -1) * Math.floor(Math.abs(n));
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill
exports.indexOf = Array.prototype.indexOf ?
function (arr, searchElement, fromIndex) {
return Array.prototype.indexOf.call(arr, searchElement, fromIndex);
} :
function (arr, searchElement, fromIndex) {
var length = this.length >>> 0; // Hack to convert object.length to a UInt32

fromIndex = +fromIndex || 0;

if(Math.abs(fromIndex) === Infinity) {
fromIndex = 0;
}
if (n >= len) {
return -1;

if(fromIndex < 0) {
fromIndex += length;
if (fromIndex < 0) {
fromIndex = 0;
}
}
var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
for (; k < len; k++) {
if (k in t && t[k] === searchElement) {
return k;

for(;fromIndex < length; fromIndex++) {
if (arr[fromIndex] === searchElement) {
return fromIndex;
}
}

return -1;
};
}

if(!Array.prototype.map) {
Array.prototype.map = function() {
Expand Down Expand Up @@ -978,6 +976,10 @@ var filters = {
},

replace: function(str, old, new_, maxCount) {
if (old instanceof RegExp) {
return str.replace(old, new_);
}

var res = str;
var last = res;
var count = 1;
Expand Down Expand Up @@ -1175,8 +1177,10 @@ var filters = {
}).map(function(word) {
var matches = word.match(puncRE);


var possibleUrl = matches && matches[1] || word;


// url that starts with http or https
if (httpHttpsRE.test(possibleUrl))
return '<a href="' + possibleUrl + '"' + noFollowAttr + '>' + possibleUrl.substr(0, length) + '</a>';
Expand All @@ -1193,7 +1197,7 @@ var filters = {
if (tldRE.test(possibleUrl))
return '<a href="http://' + possibleUrl + '"' + noFollowAttr + '>' + possibleUrl.substr(0, length) + '</a>';

return possibleUrl;
return word;

});

Expand Down Expand Up @@ -1226,12 +1230,12 @@ modules['filters'] = filters;

function cycler(items) {
var index = -1;
var current = null;
this.current = null;

return {
reset: function() {
index = -1;
current = null;
this.current = null;
},

next: function() {
Expand All @@ -1240,9 +1244,9 @@ function cycler(items) {
index = 0;
}

current = items[index];
return current;
}
this.current = items[index];
return this.current;
},
};

}
Expand Down Expand Up @@ -1312,6 +1316,7 @@ var Environment = Obj.extend({
// defaults to false
opts = opts || {};
this.dev = !!opts.dev;
this.lexerTags = opts.tags;

// The autoescape flag sets global autoescaping. If true,
// every string variable will be escaped by default.
Expand All @@ -1338,10 +1343,6 @@ var Environment = Obj.extend({
this.extensions = {};
this.extensionsList = [];

if(opts.tags) {
lexer.setTags(opts.tags);
}

for(var name in builtin_filters) {
this.addFilter(name, builtin_filters[name]);
}
Expand Down Expand Up @@ -1572,7 +1573,7 @@ var Context = Obj.extend({
},

getSuper: function(env, name, block, frame, runtime, cb) {
var idx = (this.blocks[name] || []).indexOf(block);
var idx = lib.indexOf(this.blocks[name] || [], block);
var blk = this.blocks[name][idx + 1];
var context = this;

Expand Down Expand Up @@ -1686,7 +1687,8 @@ var Template = Obj.extend({
var source = compiler.compile(this.tmplStr,
this.env.asyncFilters,
this.env.extensionsList,
this.path);
this.path,
this.env.lexerTags);
var func = new Function(source);
props = func();
}
Expand Down
4 changes: 2 additions & 2 deletions browser/nunjucks-slim.min.js

Large diffs are not rendered by default.

0 comments on commit 2b6cea6

Please sign in to comment.