From a00c598266e17bb9081291b0009baa032246cfad Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Tue, 2 May 2017 22:30:59 +0200 Subject: [PATCH 1/4] Allow partial-blocks to be executed without "options" Closes #1341 If the @partial-block is called as parameter of a helper (like in {{#if @partial-block}}...{{/if}}, the partialBlockWrapper is executed without "options"-parameter. It should still work in without an error in such a case. --- lib/handlebars/runtime.js | 3 ++- spec/regressions.js | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js index 1c084ce3..3884e88c 100644 --- a/lib/handlebars/runtime.js +++ b/lib/handlebars/runtime.js @@ -237,7 +237,8 @@ export function invokePartial(partial, context, options) { options.data = createFrame(options.data); // Wrapper function to get access to currentPartialBlock from the closure let fn = options.fn; - partialBlock = options.data['partial-block'] = function partialBlockWrapper(context, options) { + partialBlock = options.data['partial-block'] = function partialBlockWrapper(context, options = {}) { + // Restore the partial-block from the closure for the execution of the block // i.e. the part inside the block of the partial call. options.data = createFrame(options.data); diff --git a/spec/regressions.js b/spec/regressions.js index 6aca9088..1678d80c 100644 --- a/spec/regressions.js +++ b/spec/regressions.js @@ -282,4 +282,13 @@ describe('Regressions', function() { var string = '{{#each list}}{{#unless ./prop}}parent={{../value}} {{/unless}}{{/each}}'; shouldCompileTo(string, { value: 'parent', list: [ null, 'a'] }, 'parent=parent parent=parent ', ''); }); + + it('GH-1341: 4.0.7 release breaks {{#if @partial-block}} usage', function() { + var string = 'template {{>partial}} template'; + var partials = { + partialWithBlock: '{{#if @partial-block}} block {{> @partial-block}} block {{/if}}', + partial: '{{#> partialWithBlock}} partial {{/partialWithBlock}}' + }; + shouldCompileToWithPartials(string, [{}, {}, partials], true, 'template block partial block template'); + }); }); From 0e81f0a082dc970e97390795023db75b4c0faa59 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Tue, 2 May 2017 22:55:08 +0200 Subject: [PATCH 2/4] Update release notes --- release-notes.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/release-notes.md b/release-notes.md index b4d3ec07..36bec789 100644 --- a/release-notes.md +++ b/release-notes.md @@ -2,7 +2,15 @@ ## Development -[Commits](https://github.com/nknapp/handlebars.js/compare/v4.0.7...master) +[Commits](https://github.com/nknapp/handlebars.js/compare/v4.0.8...master) + +## v4.0.8 - May 2nd, 2017 +- [#1341](https://github.com/wycats/handlebars.js/issues/1341) [#1342](https://github.com/wycats/handlebars.js/issues/1342) Allow partial-blocks to be executed without "options" ([@nknapp](https://github.com/nknapp)) - a00c598 + +Compatibility notes: +- No breaking changes + +[Commits](https://github.com/nknapp/handlebars.js/compare/v4.0.7...v4.0.8) ## v4.0.7 - April 29th, 2017 - [#1319](https://github.com/wycats/handlebars.js/issues/1319): Fix context-stack when calling block-helpers on null values ([@nknapp](https://github.com/nknapp)) - c8f4b57 From fed5818876ec325b2b48a61395fe0089bdda05e8 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Tue, 2 May 2017 22:55:44 +0200 Subject: [PATCH 3/4] v4.0.8 --- components/bower.json | 2 +- components/handlebars.js.nuspec | 2 +- lib/handlebars/base.js | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/bower.json b/components/bower.json index 82d7ad1d..55eca01a 100644 --- a/components/bower.json +++ b/components/bower.json @@ -1,6 +1,6 @@ { "name": "handlebars", - "version": "4.0.7", + "version": "4.0.8", "main": "handlebars.js", "license": "MIT", "dependencies": {} diff --git a/components/handlebars.js.nuspec b/components/handlebars.js.nuspec index 1a785122..8de33981 100644 --- a/components/handlebars.js.nuspec +++ b/components/handlebars.js.nuspec @@ -2,7 +2,7 @@ handlebars.js - 4.0.7 + 4.0.8 handlebars.js Authors https://github.com/wycats/handlebars.js/blob/master/LICENSE https://github.com/wycats/handlebars.js/ diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index 615661e2..a684797c 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -4,7 +4,7 @@ import {registerDefaultHelpers} from './helpers'; import {registerDefaultDecorators} from './decorators'; import logger from './logger'; -export const VERSION = '4.0.7'; +export const VERSION = '4.0.8'; export const COMPILER_REVISION = 7; export const REVISION_CHANGES = { diff --git a/package.json b/package.json index c5bdba4f..09591755 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "handlebars", "barename": "handlebars", - "version": "4.0.7", + "version": "4.0.8", "description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration", "homepage": "http://www.handlebarsjs.com/", "keywords": [ From 7378f854c3b3afa5b2f1f9efb40d38e6528881a0 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Sat, 13 May 2017 00:23:17 +0200 Subject: [PATCH 4/4] Publish valid semver task independently of the branch --- tasks/publish.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tasks/publish.js b/tasks/publish.js index 55ea20a7..38039c6d 100644 --- a/tasks/publish.js +++ b/tasks/publish.js @@ -15,14 +15,22 @@ module.exports = function(grunt) { git.commitInfo(function(err, info) { grunt.log.writeln('tag: ' + info.tagName); + var files = []; + + // Publish the master as "latest" and with the commit-id if (info.isMaster) { + files.push('-latest'); + files.push('-' + info.head); + } + + // Publish tags by their tag-name + if (info.tagName && semver.valid(info.tagName)) { + files.push('-' + info.tagName); + } + + if (files.length > 0) { initSDK(); - - var files = ['-latest', '-' + info.head]; - if (info.tagName && semver.valid(info.tagName)) { - files.push('-' + info.tagName); - } - + grunt.log.writeln('publishing files: ' + JSON.stringify(files)); publish(fileMap(files), done); } else { // Silently ignore for branches