zulip/node_modules/handlebars/package.json

47 lines
13 KiB
JSON
Raw Normal View History

{
"name": "handlebars",
"description": "Extension of the Mustache logicless template language",
"version": "1.0.11",
"homepage": "http://www.handlebarsjs.com/",
"keywords": [
"handlebars mustache template html"
],
"repository": {
"type": "git",
"url": "git://github.com/wycats/handlebars.js.git"
},
"engines": {
"node": ">=0.4.7"
},
"dependencies": {
"optimist": "~0.3",
"uglify-js": "~1.2"
},
"devDependencies": {
"benchmark": "~1.0",
"dust": "~0.3",
"jison": "~0.3",
"mocha": "*",
"mustache": "~0.7.2"
},
"main": "lib/handlebars.js",
"bin": {
"handlebars": "bin/handlebars"
},
"scripts": {
"test": "node_modules/.bin/mocha -u qunit spec/qunit_spec.js"
},
"optionalDependencies": {},
"readme": "[![Build Status](https://travis-ci.org/wycats/handlebars.js.png?branch=master)](https://travis-ci.org/wycats/handlebars.js)\n\nHandlebars.js\n=============\n\nHandlebars.js is an extension to the [Mustache templating\nlanguage](http://mustache.github.com/) created by Chris Wanstrath.\nHandlebars.js and Mustache are both logicless templating languages that\nkeep the view and the code separated like we all know they should be.\n\nCheckout the official Handlebars docs site at\n[http://www.handlebarsjs.com](http://www.handlebarsjs.com).\n\n\nInstalling\n----------\nInstalling Handlebars is easy. Simply download the package [from the\nofficial site](http://handlebarsjs.com/) and add it to your web pages\n(you should usually use the most recent version).\n\nUsage\n-----\nIn general, the syntax of Handlebars.js templates is a superset\nof Mustache templates. For basic syntax, check out the [Mustache\nmanpage](http://mustache.github.com/mustache.5.html).\n\nOnce you have a template, use the Handlebars.compile method to compile\nthe template into a function. The generated function takes a context\nargument, which will be used to render the template.\n\n```js\nvar source = \"<p>Hello, my name is {{name}}. I am from {{hometown}}. I have \" +\n \"{{kids.length}} kids:</p>\" +\n \"<ul>{{#kids}}<li>{{name}} is {{age}}</li>{{/kids}}</ul>\";\nvar template = Handlebars.compile(source);\n\nvar data = { \"name\": \"Alan\", \"hometown\": \"Somewhere, TX\",\n \"kids\": [{\"name\": \"Jimmy\", \"age\": \"12\"}, {\"name\": \"Sally\", \"age\": \"4\"}]};\nvar result = template(data);\n\n// Would render:\n// <p>Hello, my name is Alan. I am from Somewhere, TX. I have 2 kids:</p>\n// <ul>\n// <li>Jimmy is 12</li>\n// <li>Sally is 4</li>\n// </ul>\n```\n\n\nRegistering Helpers\n-------------------\n\nYou can register helpers that Handlebars will use when evaluating your\ntemplate. Here's an example, which assumes that your objects have a URL\nembedded in them, as well as the text for a link:\n\n```js\nHandlebars.registerHelper('link_to', function(context) {\n return \"<a href='\" + context.url + \"'>\" + context.body + \"</a>\";\n});\n\nvar context = { posts: [{url: \"/hello-world\", body: \"Hello World!\"}] };\nvar source = \"<ul>{{#posts}}<li>{{{link_to this}}}</li>{{/posts}}</ul>\"\n\nvar template = Handlebars.compile(source);\ntemplate(context);\n\n// Would render:\n//\n// <ul>\n// <li><a href='/hello-world'>Hello World!</a></li>\n// </ul>\n```\n\nEscaping\n--------\n\nBy default, the `{{expression}}` syntax will escape its contents. This\nhelps to protect you against accidental XSS problems caused by malicious\ndata passed from the server as JSON.\n\nTo explicitly *not* escape the contents, use the triple-mustache\n(`{{{}}}`). You have seen this used in the above example.\n\n\nDifferences Between Handlebars.js and Mustache\n----------------------------------------------\nHandlebars.js adds a couple of additional features to make writing\ntemplates easier and also changes a tiny detail of how partials work.\n\n### Paths\n\nHandlebars.js supports an extended expression syntax that we call paths.\nPaths are made up of typical expressions and . characters. Expressions\nallow you to not only display data from the current context, but to\ndisplay data from contexts that are descendents and ancestors of the\ncurrent context.\n\nTo display data from descendent contexts, use the `.` character. So, for\nexample, if your data were structured like:\n\n```js\nvar data = {\"person\": { \"name\": \"Alan\" }, company: {\"name\": \"Rad, Inc.\" } };\n```\n\nyou could display the person's name from the top-level context with the\nfollowing expression:\n\n```\n{{person.name}}\n```\n\nYou can backtrack using `../`. For example, if you've already traversed\ninto the person object you could still display the company's name with\nan expression like `{{../company.name}}`, so:\n\n```\n{{#person}}{{name}} - {{../company.name}}{{/person}}\n```\n\nwould render:\n\n```\nAlan - Rad, Inc.\n```\n\n### Strings\n\nWhen call
"readmeFilename": "README.markdown",
"bugs": {
"url": "https://github.com/wycats/handlebars.js/issues"
},
"_id": "handlebars@1.0.11",
"dist": {
"shasum": "0a7f8ac34a41929ce1a9b0429283b31c76812b17"
},
"_from": "handlebars@1.0.11",
"_resolved": "https://registry.npmjs.org/handlebars/-/handlebars-1.0.11.tgz"
}