Comparing version 1.0.0 to 1.0.1
@@ -33,1 +33,4 @@ var handlebars = require('handlebars'); | ||
}; | ||
exports.SafeString = handlebars.SafeString; | ||
exports.Utils = handlebars.Utils; |
{ | ||
"name": "hbs", | ||
"description": "Express.js template engine plugin for Handlebars", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"homepage": "https://github.com/donpark/hbs", | ||
@@ -6,0 +6,0 @@ "author": "Don Park <donpark@docuverse.com> (http://blog.docuverse.com)", |
@@ -29,3 +29,3 @@ # hbs # | ||
Block Helper support is broken currently. | ||
`__get__` function is not supported within block helper functions. | ||
@@ -32,0 +32,0 @@ ## Migrating to 1.0.0 ## |
@@ -7,3 +7,6 @@ | ||
var express = require('express'); | ||
var util = require('util'); | ||
var test_local_hbs = true; | ||
var hbs = require(test_local_hbs ? '../../lib/hbs' : 'hbs'); | ||
/** | ||
@@ -14,4 +17,5 @@ * HACK: Install local `hbs` view engine for testing purpose. | ||
*/ | ||
var hbs = require('../../lib/hbs'); | ||
express.view.register('.hbs', hbs); | ||
if (test_local_hbs) { | ||
express.view.register('.hbs', hbs); | ||
} | ||
@@ -49,9 +53,10 @@ var app = module.exports = express.createServer(); | ||
hbs.registerHelper('link', function(context, fn) { | ||
return '<a href="/people/' + this.__get__("id") + '">' + fn(this) + '</a>'; | ||
hbs.registerHelper('list', function(items, fn) { | ||
var out = "<ul>"; | ||
for(var i=0, l=items.length; i<l; i++) { | ||
out = out + "<li>" + fn(items[i]) + "</li>"; | ||
} | ||
return out + "</ul>"; | ||
}); | ||
/* | ||
<h3>Handlebars Block Helper Test</h3> | ||
<ul>{{#people}}<li>{{#link}}{{name}}{{/link}}</li>{{/people}}</ul> | ||
*/ | ||
hbs.registerPartial('link2', '<a href="/people/{{id}}">{{name}}</a>'); | ||
@@ -76,9 +81,18 @@ | ||
posts2: [{url: "/hello-world", body: "Hello World!"}], | ||
// block helper | ||
// for block helper test | ||
people: [ | ||
{firstName: "Yehuda", lastName: "Katz"}, | ||
{firstName: "Carl", lastName: "Lerche"}, | ||
{firstName: "Alan", lastName: "Johnson"} | ||
], | ||
people2: [ | ||
{ name: { firstName: "Yehuda", lastName: "Katz" } }, | ||
{ name: { firstName: "Carl", lastName: "Lerche" } }, | ||
{ name: { firstName: "Alan", lastName: "Johnson" } } | ||
], | ||
// for partial test | ||
people3: [ | ||
{ "name": "Alan", "id": 1 }, | ||
{ "name": "Yehuda", "id": 2 } | ||
], | ||
// partial | ||
] | ||
}); | ||
@@ -85,0 +99,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
7545
114
0
2