Socket
Socket
Sign inDemoInstall

handlebars-layouts

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebars-layouts - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

test/expected/templates/context.html

1

bower.json
{
"name": "handlebars-layouts",
"version": "1.1.0",
"description": "Handlebars helpers which implement layout blocks similar to Jade, Jinja, Swig, and Twig.",

@@ -5,0 +4,0 @@ "main": "dist/handlebars-layouts.js",

@@ -0,1 +1,13 @@

## 3.1.1
Bugfixes:
- Corrected handling of partial context when the native syntax is used inside of an embed. ([#25](https://github.com/shannonmoeller/handlebars-layouts/pull/25))
## 3.1.0
Features:
- The `extend` and `embed` helpers now support a [custom context](http://handlebarsjs.com/partials.html#partial-context) to match the signature and features of the default partials syntax: `{{> partialName contextObject foo=bar }}`. ([#21](https://github.com/shannonmoeller/handlebars-layouts/pull/21))
## 3.0.0

@@ -2,0 +14,0 @@

@@ -104,3 +104,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.handlebarsLayouts = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

var fn = options.fn || noop,
context = Object.create(this || {}),
context = handlebars.createFrame(this || {}),
template = handlebars.partials[name];

@@ -138,3 +138,3 @@

embed: function () {
var context = Object.create(this || {});
var context = handlebars.createFrame(this || {});

@@ -141,0 +141,0 @@ // Reset context

@@ -103,3 +103,3 @@ 'use strict';

var fn = options.fn || noop,
context = Object.create(this || {}),
context = handlebars.createFrame(this || {}),
template = handlebars.partials[name];

@@ -137,3 +137,3 @@

embed: function () {
var context = Object.create(this || {});
var context = handlebars.createFrame(this || {});

@@ -140,0 +140,0 @@ // Reset context

{
"name": "handlebars-layouts",
"version": "3.1.0",
"version": "3.1.1",
"description": "Handlebars helpers which implement layout blocks similar to Jade, Jinja, Swig, and Twig.",

@@ -52,3 +52,4 @@ "keywords": [

"node": ">= 0.10"
}
},
"dependencies": {}
}
# `handlebars-layouts`
[![NPM version][npm-img]][npm-url] [![Downloads][downloads-img]][npm-url] [![Build Status][travis-img]][travis-url] [![Coverage Status][coveralls-img]][coveralls-url] [![Chat][gitter-img]][gitter-url]
[![NPM version][npm-img]][npm-url] [![Downloads][downloads-img]][npm-url] [![Build Status][travis-img]][travis-url] [![Coverage Status][coveralls-img]][coveralls-url] [![Chat][gitter-img]][gitter-url] [![Tip][amazon-img]][amazon-url]

@@ -49,5 +49,6 @@ Handlebars helpers which implement layout blocks similar to Jade, Jinja, Swig, and Twig.

### `{{#extend [partial] [key=value ...]}}`
### `{{#extend [partial] [context] [key=value ...]}}`
- `partial` `String` - Name of partial to render.
- `context` `Object` _(Optional)_ - A custom context for the partial.
- `attributes` `Object` _(Optional)_ - Arbitrary values that will be added to the partial data context.

@@ -77,5 +78,6 @@

### `{{#embed [partial] [key=value ...]}}`
### `{{#embed [partial] [context] [key=value ...]}}`
- `partial` `String` - Name of partial to render.
- `context` `Object` _(Optional)_ - A custom context for the partial.
- `attributes` `Object` _(Optional)_ - Arbitrary values that will be added to the partial data context.

@@ -418,3 +420,3 @@

[![Tasks][waffle-img]][waffle-url] [![Tip][gittip-img]][gittip-url]
[![Tasks][waffle-img]][waffle-url]

@@ -433,2 +435,4 @@ Standards for this project, including tests, code coverage, and semantics are enforced with a build tool. Pull requests must include passing tests with 100% code coverage and no linting errors.

[amazon-img]: https://img.shields.io/badge/amazon-tip_jar-yellow.svg?style=flat-square
[amazon-url]: https://www.amazon.com/gp/registry/wishlist/1VQM9ID04YPC5?sort=universal-price
[coveralls-img]: http://img.shields.io/coveralls/shannonmoeller/handlebars-layouts/master.svg?style=flat-square

@@ -439,4 +443,2 @@ [coveralls-url]: https://coveralls.io/r/shannonmoeller/handlebars-layouts

[gitter-url]: https://gitter.im/shannonmoeller/shannonmoeller
[gittip-img]: http://img.shields.io/gittip/shannonmoeller.svg?style=flat-square
[gittip-url]: https://www.gittip.com/shannonmoeller
[npm-img]: http://img.shields.io/npm/v/handlebars-layouts.svg?style=flat-square

@@ -443,0 +445,0 @@ [npm-url]: https://npmjs.org/package/handlebars-layouts

@@ -77,2 +77,4 @@ /*eslint-env mocha */

'deep-c': read(config.partials + '/deep-c.hbs'),
context: read(config.partials + '/context.hbs'),
'parent-context': read(config.partials + '/parent-context.hbs'),
layout: read(config.partials + '/layout.hbs'),

@@ -95,2 +97,6 @@ layout2col: read(config.partials + '/layout2col.hbs'),

it('should preserve context', function (done) {
testWithFile('context.html', {root: 'root'}, done);
});
it('should embed layouts', function (done) {

@@ -97,0 +103,0 @@ var data = require('./fixtures/data/users.json');

@@ -5,2 +5,3 @@ /*eslint-env mocha */

var handlebarsLayouts = require('../index'),
handlebars = require('handlebars'),
expect = require('expect');

@@ -14,23 +15,13 @@

hbs = {
partials: {
foo: function (data) {
count++;
hbs = handlebars.create();
return data && data.foo || '';
}
},
registerHelper: function (helpers) {
count++;
hbs.registerPartial('foo', function (data) {
count++;
expect(helpers.extend).toBeA(Function);
expect(helpers.embed).toBeA(Function);
expect(helpers.block).toBeA(Function);
expect(helpers.content).toBeA(Function);
}
};
return data && data.foo || '';
});
});
it('should generate helpers', function () {
var helpers = handlebarsLayouts(hbs);
var helpers = handlebarsLayouts(handlebarsLayouts);

@@ -49,3 +40,8 @@ expect(helpers.extend).toBeA(Function);

expect(count).toBe(1);
expect(hbs.helpers.extend).toBeA(Function);
expect(hbs.helpers.embed).toBeA(Function);
expect(hbs.helpers.block).toBeA(Function);
expect(hbs.helpers.content).toBeA(Function);
expect(count).toBe(0);
});

@@ -61,3 +57,3 @@ });

expect(count).toBe(3);
expect(count).toBe(2);
});

@@ -73,3 +69,3 @@ });

expect(count).toBe(3);
expect(count).toBe(2);
});

@@ -85,3 +81,3 @@ });

expect(count).toBe(1);
expect(count).toBe(0);
});

@@ -97,5 +93,5 @@ });

expect(count).toBe(1);
expect(count).toBe(0);
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc