{"_id":"stencil-js","_rev":"31-4fa3746ff797dbfbd443b78a394b433d","name":"stencil-js","description":"Async JavaScript Templating","dist-tags":{"latest":"0.8.4"},"versions":{"0.5.0":{"name":"stencil-js","description":"Async JavaScript Templating","version":"0.5.0","author":{"name":"Andy VanWagoner","email":"thetalecrafter@gmail.com"},"keywords":["stencil","template","view","asynchronous"],"repository":{"type":"git","url":"git://github.com/thetalecrafter/stencil"},"main":"stencil","engines":{"node":"*"},"readme":"# stencil\n\nstencil is a templating engine designed by Andy VanWagoner\n([thetalecrafter](http://github.com/thetalecrafter))\nto enable templates to run in an environment with asynchronous I/O,\nsuch as [node](http://nodejs.org), as well as in the browser.\n\nWhile there have been many other libraries with the same claims,\nall of the ones currently maintained use the mustache syntax,\nwhile this uses asp / erb / php style syntax.\n\n## Features\n\n  * Async nested templates\n  * Async tag to ensure template is processed sequentially\n  * Use the same template code both server and client side\n\n\n## Shared templates\n\nThe motivator for stencil was to share templates between server and client code.\nThe template can be used server side to generate a widget in the initial page load,\nand then the template can be included on the page to update the widget.\n\nThe code to generate and update a widget can be the same file.\n\n\n## Usage - template code\n\nTemplates are specified using php/asp syntax, with code inside special tags.\nBy default the tags are php-style:\n\n```php\n<? javascript code here ?>\n```\n\nThere are also suffixes to the opening tag for ouput, include, and async blocks.\n\n```php\n<?= 'Today is ' + (new Date()) // result is html encoded and included in output ?>\n<?= 'hello', ' ', 'world' // multiple results can be output ?>\n<?- '<em>Important</em>' // This output won't be encoded ?>\n\n<?# 'child-template-id' // result passed as id to include() ?>\n<?# { id:'child', async:'~' }, { custom:'data' } // override options and data variables in child template ?>\n\n<?! setTimeout(next, 1000); // functionally equivalent to php sleep(1) ?>\n<?! someAsyncFunction(param1, function whendone(result) {\n\t\t// do stuff with result\n\t\tprint(result);\n\t\tnext(); // continue processing the rest of the template\n\t}); ?>\n```\n\nMembers of the data object are put in the scope of the template code:\n\n```html\n<script type=\"text/template\" id=\"template\"><[CDATA[\n\tWhy I don't teach English anymore:\n\t<?= message ?>.\n]]></script>\n<script>\n\tstencil({ id:'template' }, { message:'The book is not on the table' },\n\t\tfunction(err, result) {\n\t\t\tif (err) return console.log('The template failed to run.');\n\t\t\tconsole.log('The template result was:' + result);\n\t\t}\n\t);\n</script>\n```\n\n\nImportant note:\n\nUnlike regular code tags, async tags cannot not include partial statements.\nAll of the code inside will be wrapped into a function.\nAll of the code following will also be wrapped into a function.\n\nThis would not work:\n\n```php\n<?! if (true) { ?>some output<? } ?>\n```\n\nSince compiled it would be similar to:\n\n```javascript\n(function(next){ if (true) { })(function() { print('some output'); } });\n```\n\n\n## Usage - client side\n\n```html\n<script src=\"stencil.js\"></script>\n<script type=\"text/template\" id=\"dom_id\">\n\t<[CDATA[\n\t... template code here ...\n\t]]>\n</script>\n<script>\n\tstencil.compile({ id:'dom_id' }, function(err, template) {\n\t\ttemplate(\n\t\t\t{ data:object },\n\t\t\tfunction(data) { /* optional - use the data chunks */ },\n\t\t\tfunction(err, result) { /* all done */ },\n\t\t);\n\t});\n\n\t// or\n\n\tstencil('dom_id', { data:object }, function(err, result) {\n\t\t/* all done */ \n\t\tif (err) { /* you broke it */ return; }\n\t\t/* use the result */\n\t});\n</script>\n```\n\n\n## Usage - server side\n\n```javascript\nvar stencil = require('./stencil');\n\nstencil('/path/to/template', { data:object },\n\tfunction(data) { /* use the data chunks */ },\n\tfunction(err, result) { /* all done */ }\n);\n\n// same variations apply as client side.\n```\n\n\n## Usage - custom tags\n\n```javascript\nstencil({\n\tid:    id,\n\tstart: '`',\n\tstop:  '`',\n\techo:  'print',\n\tsafe:  'encode',\n\tnest:  ' include this template:',\n\tasync: '@'\n}, data, function(err, result) {\n\t// here's my result\n});\n\n// template code:\nMy pet is `if (hungry) { `hungry` } else { `sleepy` }`.\nHis name is: `print pet.name`.\nHe looks like: ` include this template: 'looks_like', pet `.\n`@my_async_function(function(result) { print(result); next(); });`\nthe end.\n```\n\n\n## Usage - synchronous\n\nYou can fetch templates synchronously, if you need to. The caveat here\nis that you cannot do anything asynchronous in your template, or\nyou will only get the ouput up until the first asynchronous part. The setting\nreally only makes includes happen synchronously.\n\n```javascript\ntry { var result = stencil({ id:'id', sync_include:true }, data); }\ncatch (err) { /* You broke it. */ }\n```\n\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 Andy VanWagoner\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"stencil-js@0.5.0","dist":{"shasum":"bdc9f5f839ed8e3e01105f424c031f5e00d170ac","tarball":"https://registry.npmjs.org/stencil-js/-/stencil-js-0.5.0.tgz","integrity":"sha512-nVpcS84ir5wuRXI3In2/0DBrqwxwIsBwbXrjLe/iBxHZoPEYr82pIwZA+Vo4AZ8TvhU53n4RGJ7wkFSept3tTw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCDo6Vm4zEO/CaIEx0Tf5pakszVOWyitqSTs2pRDcuekAIhAK/cMcq4ZKUlqrVRQ4zA12bTSVltelCU89+XOdp9ADQz"}]},"maintainers":[{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"}],"directories":{}},"0.6.0":{"name":"stencil-js","description":"Async JavaScript Templating","version":"0.6.0","author":{"name":"Andy VanWagoner","email":"thetalecrafter@gmail.com"},"keywords":["stencil","template","view","asynchronous"],"repository":{"type":"git","url":"git://github.com/thetalecrafter/stencil"},"main":"stencil","engines":{"node":"*"},"readme":"# stencil\n\nstencil is a templating engine designed by Andy VanWagoner\n([thetalecrafter](http://github.com/thetalecrafter))\nto enable templates to run in an environment with asynchronous I/O,\nsuch as [node](http://nodejs.org), as well as in the browser.\n\nWhile there have been many other libraries with the same claims,\nall of the ones currently maintained use the mustache syntax,\nwhile this uses asp / erb / php style syntax.\n\n## Features\n\n  * Async nested templates\n  * Async tag to ensure template is processed sequentially\n  * Use the same template code both server and client side\n\n\n## Shared templates\n\nThe motivator for stencil was to share templates between server and client code.\nThe template can be used server side to generate a widget in the initial page load,\nand then the template can be included on the page to update the widget.\n\nThe code to generate and update a widget can be the same file.\n\n\n## Usage - template code\n\nTemplates are specified using php/asp syntax, with code inside special tags.\nBy default the tags are php-style:\n\n```php\n<? javascript code here ?>\n```\n\nThere are also suffixes to the opening tag for ouput, include, and async blocks.\n\n```php\n<?= 'Today is ' + (new Date()) // result is html encoded and included in output ?>\n<?= 'hello', ' ', 'world' // multiple results can be output ?>\n<?- '<em>Important</em>' // This output won't be encoded ?>\n\n<?# 'child-template-id' // result passed as id to include() ?>\n<?# { id:'child', async:'~' }, { custom:'data' } // override options and data variables in child template ?>\n\n<?! setTimeout(next, 1000); // functionally equivalent to php sleep(1) ?>\n<?! someAsyncFunction(param1, function whendone(result) {\n\t\t// do stuff with result\n\t\tprint(result);\n\t\tnext(); // continue processing the rest of the template\n\t}); ?>\n```\n\nMembers of the data object are put in the scope of the template code:\n\n```html\n<script type=\"text/template\" id=\"template\"><[CDATA[\n\tWhy I don't teach English anymore:\n\t<?= message ?>.\n]]></script>\n<script>\n\tstencil({ id:'template' }, { message:'The book is not on the table' },\n\t\tfunction(err, result) {\n\t\t\tif (err) return console.log('The template failed to run.');\n\t\t\tconsole.log('The template result was:' + result);\n\t\t}\n\t);\n</script>\n```\n\n\nImportant note:\n\nUnlike regular code tags, async tags cannot not include partial statements.\nAll of the code inside will be wrapped into a function.\nAll of the code following will also be wrapped into a function.\n\nThis would not work:\n\n```php\n<?! if (true) { ?>some output<? } ?>\n```\n\nSince compiled it would be similar to:\n\n```javascript\n(function(next){ if (true) { })(function() { print('some output'); } });\n```\n\n\n## Usage - client side\n\n```html\n<script src=\"stencil.js\"></script>\n<script type=\"text/template\" id=\"dom_id\">\n\t<[CDATA[\n\t... template code here ...\n\t]]>\n</script>\n<script>\n\tstencil.compile({ id:'dom_id' }, function(err, template) {\n\t\ttemplate(\n\t\t\t{ data:object },\n\t\t\tfunction(data) { /* optional - use the data chunks */ },\n\t\t\tfunction(err, result) { /* all done */ },\n\t\t);\n\t});\n\n\t// or\n\n\tstencil('dom_id', { data:object }, function(err, result) {\n\t\t/* all done */ \n\t\tif (err) { /* you broke it */ return; }\n\t\t/* use the result */\n\t});\n</script>\n```\n\n\n## Usage - server side\n\n```javascript\nvar stencil = require('./stencil');\n\nstencil('/path/to/template', { data:object },\n\tfunction(data) { /* use the data chunks */ },\n\tfunction(err, result) { /* all done */ }\n);\n\n// same variations apply as client side.\n```\n\n\n## Usage - custom tags\n\n```javascript\n\n// override defaults for this template\nstencil({\n\tid:    id,\n\tstart: '`',\n\tstop:  '`',\n\techo:  'print',\n\tsafe:  'encode',\n\tnest:  ' include this template:',\n\tasync: '@'\n}, data, function(err, result) {\n\t// here's my result\n});\n\n// or for all templates\nstencil.defaults.start = '`';\nstencil.defaults.stop  = '`';\n...\n\n// template code:\nMy pet is `if (hungry) { `hungry` } else { `sleepy` }`.\nHis name is: `print pet.name`.\nHe looks like: ` include this template: 'looks_like', pet `.\n`@my_async_function(function(result) { print(result); next(); });`\nthe end.\n```\n\n\n## Usage - extras\n\nYou can fetch templates synchronously, if you need to. The caveat here\nis that you cannot do anything asynchronous in your template, or\nyou will only get the ouput up until the first asynchronous part. The setting\nreally only makes includes happen synchronously.\n\n```javascript\ntry { var result = stencil({ id:'id', sync_include:true }, data); }\ncatch (err) { /* You broke it. */ }\n```\n\nYou can also compile templates without a 'with' statement, by including a\nreference to uglify-js's parse function. This will improve the rendering\nperformance, but is expensive at compile time.\n\n```javascript\nstencil.compile({ id:'id', parse:require('uglify-js').parser.parse }, function(err, fn) {\n\t// fn does not use the 'with' statement\n})\n```\n\nRemoving the 'with' statement also means all variables in your template\nare declared with 'var', so you can't create implicit globals, and you\nwon't get errors by using a context variable that wasn't passed in.\n\n```php\n<?\n\t// data passed in does not contain either variable\n\tbogus_var = 'bogus'; // won't implicitly create a global\n\tif (maybe_var) { // won't throw an error\n\t\t/* use maybe_var */\n\t}\n?>\n```\n\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 Andy VanWagoner\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"stencil-js@0.6.0","dist":{"shasum":"24993a8719f6e1c98d6c624ba31279f7247ba6af","tarball":"https://registry.npmjs.org/stencil-js/-/stencil-js-0.6.0.tgz","integrity":"sha512-LisKGZNwhUCqwe8Bkxo+Sm2c+JDu52qqMdiG9EhOoCm88bMlc9MJoCmyHyc/qEgY/9WIlq39AKzNWEJRkax2HA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDh7iSP3/wgnOGhbm/rVLDxHE2U0xgU1GDGkgQ9Fs+xJAIhAPcs6CFETXRpb7ZfZa1J/mH/U531zzsvJmv0AyxoHRVW"}]},"maintainers":[{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"}],"directories":{}},"0.6.1":{"name":"stencil-js","description":"Async JavaScript Templating","version":"0.6.1","author":{"name":"Andy VanWagoner","email":"thetalecrafter@gmail.com"},"keywords":["stencil","template","view","asynchronous"],"repository":{"type":"git","url":"git://github.com/thetalecrafter/stencil.git"},"main":"stencil","engines":{"node":"*"},"readme":"# stencil\n\nstencil is a templating engine designed by Andy VanWagoner\n([thetalecrafter](http://github.com/thetalecrafter))\nto enable templates to run in an environment with asynchronous I/O,\nsuch as [node](http://nodejs.org), as well as in the browser.\n\nWhile there have been many other libraries with the same claims,\nall of the ones currently maintained use the mustache syntax,\nwhile this uses asp / erb / php style syntax.\n\n## Features\n\n  * Async nested templates\n  * Async tag to ensure template is processed sequentially\n  * Use the same template code both server and client side\n\n\n## Shared templates\n\nThe motivator for stencil was to share templates between server and client code.\nThe template can be used server side to generate a widget in the initial page load,\nand then the template can be included on the page to update the widget.\n\nThe code to generate and update a widget can be the same file.\n\n\n## Usage - template code\n\nTemplates are specified using php/asp syntax, with code inside special tags.\nBy default the tags are php-style:\n\n```php\n<? javascript code here ?>\n```\n\nThere are also suffixes to the opening tag for ouput, include, and async blocks.\n\n```php\n<?= 'Today is ' + (new Date()) // result is html encoded and included in output ?>\n<?= 'hello', ' ', 'world' // multiple results can be output ?>\n<?- '<em>Important</em>' // This output won't be encoded ?>\n\n<?# 'child-template-id' // result passed as id to include() ?>\n<?# { id:'child', async:'~' }, { custom:'data' } // override options and data variables in child template ?>\n\n<?! setTimeout(next, 1000); // functionally equivalent to php sleep(1) ?>\n<?! someAsyncFunction(param1, function whendone(result) {\n\t\t// do stuff with result\n\t\tprint(result);\n\t\tnext(); // continue processing the rest of the template\n\t}); ?>\n```\n\nMembers of the data object are put in the scope of the template code:\n\n```html\n<script type=\"text/template\" id=\"template\"><[CDATA[\n\tWhy I don't teach English anymore:\n\t<?= message ?>.\n]]></script>\n<script>\n\tstencil({ id:'template' }, { message:'The book is not on the table' },\n\t\tfunction(err, result) {\n\t\t\tif (err) return console.log('The template failed to run.');\n\t\t\tconsole.log('The template result was:' + result);\n\t\t}\n\t);\n</script>\n```\n\n\nImportant note:\n\nUnlike regular code tags, async tags cannot not include partial statements.\nAll of the code inside will be wrapped into a function.\nAll of the code following will also be wrapped into a function.\n\nThis would not work:\n\n```php\n<?! if (true) { ?>some output<? } ?>\n```\n\nSince compiled it would be similar to:\n\n```javascript\n(function(next){ if (true) { })(function() { print('some output'); } });\n```\n\n\n## Usage - client side\n\n```html\n<script src=\"stencil.js\"></script>\n<script type=\"text/template\" id=\"dom_id\">\n\t<[CDATA[\n\t... template code here ...\n\t]]>\n</script>\n<script>\n\tstencil.compile({ id:'dom_id' }, function(err, template) {\n\t\ttemplate(\n\t\t\t{ data:object },\n\t\t\tfunction(data) { /* optional - use the data chunks */ },\n\t\t\tfunction(err, result) { /* all done */ },\n\t\t);\n\t});\n\n\t// or\n\n\tstencil('dom_id', { data:object }, function(err, result) {\n\t\t/* all done */ \n\t\tif (err) { /* you broke it */ return; }\n\t\t/* use the result */\n\t});\n</script>\n```\n\n\n## Usage - server side\n\n```javascript\nvar stencil = require('./stencil');\n\nstencil('/path/to/template', { data:object },\n\tfunction(data) { /* use the data chunks */ },\n\tfunction(err, result) { /* all done */ }\n);\n\n// same variations apply as client side.\n```\n\n\n## Usage - custom tags\n\n```javascript\n\n// override defaults for this template\nstencil({\n\tid:    id,\n\tstart: '`',\n\tstop:  '`',\n\techo:  'print',\n\tsafe:  'encode',\n\tnest:  ' include this template:',\n\tasync: '@'\n}, data, function(err, result) {\n\t// here's my result\n});\n\n// or for all templates\nstencil.defaults.start = '`';\nstencil.defaults.stop  = '`';\n...\n\n// template code:\nMy pet is `if (hungry) { `hungry` } else { `sleepy` }`.\nHis name is: `print pet.name`.\nHe looks like: ` include this template: 'looks_like', pet `.\n`@my_async_function(function(result) { print(result); next(); });`\nthe end.\n```\n\n\n## Usage - extras\n\nYou can fetch templates synchronously, if you need to. The caveat here\nis that you cannot do anything asynchronous in your template, or\nyou will only get the ouput up until the first asynchronous part. The setting\nreally only makes includes happen synchronously.\n\n```javascript\ntry { var result = stencil({ id:'id', sync_include:true }, data); }\ncatch (err) { /* You broke it. */ }\n```\n\nOr if you have don't get the template by dom id, ajax call, (or by filename\nin node), you can pass in the 'fetch' option a function that retrieves\nthe template text and has this signature: (stencil_options, next(error, text))\n\n\nYou can also compile templates without a 'with' statement, by including a\nreference to uglify-js's parse function. This will improve the rendering\nperformance, but is expensive at compile time.\n\n```javascript\nstencil.compile({ id:'id', parse:require('uglify-js').parser.parse }, function(err, fn) {\n\t// fn does not use the 'with' statement\n})\n```\n\nRemoving the 'with' statement also means all variables in your template\nare declared with 'var', so you can't create implicit globals, and you\nwon't get errors by using a context variable that wasn't passed in.\n\n```php\n<?\n\t// data passed in does not contain either variable\n\tbogus_var = 'bogus'; // won't implicitly create a global\n\tif (maybe_var) { // won't throw an error\n\t\t/* use maybe_var */\n\t}\n?>\n```\n\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 Andy VanWagoner\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"stencil-js@0.6.1","dist":{"shasum":"2ec781e564fa2593d6fa838bf4c87935934f9885","tarball":"https://registry.npmjs.org/stencil-js/-/stencil-js-0.6.1.tgz","integrity":"sha512-4xeqN75+wxHyHOuFgfrLzlAu0/zZCxYj85oHv0gKBC5/ArA9QHOpK+q4Sl+TH0oQ48xt1lWnKcKQI8xPA/FHNg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCD5LglT3KWlIbnt9EQa7m+O1l1Oqei10Kf8EQ10xHfmgIgL3kwR/TGUgtp4IAsYG8TzF2qeeukrtNp6yzuuoFgSBI="}]},"maintainers":[{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"}],"directories":{}},"0.6.2":{"name":"stencil-js","description":"Async JavaScript Templating","version":"0.6.2","author":{"name":"Andy VanWagoner","email":"thetalecrafter@gmail.com"},"keywords":["stencil","template","view","asynchronous"],"repository":{"type":"git","url":"git://github.com/thetalecrafter/stencil.git"},"main":"stencil","engines":{"node":"*"},"readme":"# stencil\n\nstencil is a templating engine designed by Andy VanWagoner\n([thetalecrafter](http://github.com/thetalecrafter))\nto enable templates to run in an environment with asynchronous I/O,\nsuch as [node](http://nodejs.org), as well as in the browser.\n\nWhile there have been many other libraries with the same claims,\nall of the ones currently maintained use the mustache syntax,\nwhile this uses asp / erb / php style syntax.\n\n## Features\n\n  * Async nested templates\n  * Async tag to ensure template is processed sequentially\n  * Use the same template code both server and client side\n\n\n## Shared templates\n\nThe motivator for stencil was to share templates between server and client code.\nThe template can be used server side to generate a widget in the initial page load,\nand then the template can be included on the page to update the widget.\n\nThe code to generate and update a widget can be the same file.\n\n\n## Usage - template code\n\nTemplates are specified using php/asp syntax, with code inside special tags.\nBy default the tags are php-style:\n\n```php\n<? javascript code here ?>\n```\n\nThere are also suffixes to the opening tag for ouput, include, and async blocks.\n\n```php\n<?= 'Today is ' + (new Date()) // result is html encoded and included in output ?>\n<?= 'hello', ' ', 'world' // multiple results can be output ?>\n<?- '<em>Important</em>' // This output won't be encoded ?>\n\n<?# 'child-template-id' // result passed as id to include() ?>\n<?# { id:'child', async:'~' }, { custom:'data' } // override options and data variables in child template ?>\n\n<?! setTimeout(next, 1000); // functionally equivalent to php sleep(1) ?>\n<?! someAsyncFunction(param1, function whendone(result) {\n\t\t// do stuff with result\n\t\tprint(result);\n\t\tnext(); // continue processing the rest of the template\n\t}); ?>\n```\n\nMembers of the data object are put in the scope of the template code:\n\n```html\n<script type=\"text/template\" id=\"template\"><[CDATA[\n\tWhy I don't teach English anymore:\n\t<?= message ?>.\n]]></script>\n<script>\n\tstencil({ id:'template' }, { message:'The book is not on the table' },\n\t\tfunction(err, result) {\n\t\t\tif (err) return console.log('The template failed to run.');\n\t\t\tconsole.log('The template result was:' + result);\n\t\t}\n\t);\n</script>\n```\n\n\nImportant note:\n\nUnlike regular code tags, async tags cannot not include partial statements.\nAll of the code inside will be wrapped into a function.\nAll of the code following will also be wrapped into a function.\n\nThis would not work:\n\n```php\n<?! if (true) { ?>some output<? } ?>\n```\n\nSince compiled it would be similar to:\n\n```javascript\n(function(next){ if (true) { })(function() { print('some output'); } });\n```\n\n\n## Usage - client side\n\n```html\n<script src=\"stencil.js\"></script>\n<script type=\"text/template\" id=\"dom_id\">\n\t<[CDATA[\n\t... template code here ...\n\t]]>\n</script>\n<script>\n\tstencil.compile({ id:'dom_id' }, function(err, template) {\n\t\ttemplate(\n\t\t\t{ data:object },\n\t\t\tfunction(data) { /* optional - use the data chunks */ },\n\t\t\tfunction(err, result) { /* all done */ },\n\t\t);\n\t});\n\n\t// or\n\n\tstencil('dom_id', { data:object }, function(err, result) {\n\t\t/* all done */ \n\t\tif (err) { /* you broke it */ return; }\n\t\t/* use the result */\n\t});\n</script>\n```\n\n\n## Usage - server side\n\n```javascript\nvar stencil = require('./stencil');\n\nstencil('/path/to/template', { data:object },\n\tfunction(data) { /* use the data chunks */ },\n\tfunction(err, result) { /* all done */ }\n);\n\n// same variations apply as client side.\n```\n\n\n## Usage - custom tags\n\n```javascript\n\n// override defaults for this template\nstencil({\n\tid:    id,\n\tstart: '`',\n\tstop:  '`',\n\techo:  'print',\n\tsafe:  'encode',\n\tnest:  ' include this template:',\n\tasync: '@'\n}, data, function(err, result) {\n\t// here's my result\n});\n\n// or for all templates\nstencil.defaults.start = '`';\nstencil.defaults.stop  = '`';\n...\n\n// template code:\nMy pet is `if (hungry) { `hungry` } else { `sleepy` }`.\nHis name is: `print pet.name`.\nHe looks like: ` include this template: 'looks_like', pet `.\n`@my_async_function(function(result) { print(result); next(); });`\nthe end.\n```\n\n\n## Usage - extras\n\nYou can fetch templates synchronously, if you need to. The caveat here\nis that you cannot do anything asynchronous in your template, or\nyou will only get the ouput up until the first asynchronous part. The setting\nreally only makes includes happen synchronously.\n\n```javascript\ntry { var result = stencil({ id:'id', sync_include:true }, data); }\ncatch (err) { /* You broke it. */ }\n```\n\nOr if you have don't get the template by dom id, ajax call, (or by filename\nin node), you can pass in the 'fetch' option a function that retrieves\nthe template text and has this signature: (stencil_options, next(error, text))\n\n\nYou can also compile templates without a 'with' statement, by including a\nreference to uglify-js's parse function. This will improve the rendering\nperformance, but is expensive at compile time.\n\n```javascript\nstencil.compile({ id:'id', parse:require('uglify-js').parser.parse }, function(err, fn) {\n\t// fn does not use the 'with' statement\n})\n```\n\nRemoving the 'with' statement also means all variables in your template\nare declared with 'var', so you can't create implicit globals, and you\nwon't get errors by using a context variable that wasn't passed in.\n\n```php\n<?\n\t// data passed in does not contain either variable\n\tbogus_var = 'bogus'; // won't implicitly create a global\n\tif (maybe_var) { // won't throw an error\n\t\t/* use maybe_var */\n\t}\n?>\n```\n\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 Andy VanWagoner\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"stencil-js@0.6.2","dist":{"shasum":"9b1c31e9642563476785bc880ddf315684f7e34b","tarball":"https://registry.npmjs.org/stencil-js/-/stencil-js-0.6.2.tgz","integrity":"sha512-sdTNjwinlnqXhsypy14TG19uiYSgqc7zDxNo6wGCt1wudpKey4ogaF0evpsjVpbXmw54wtZa8nGAyegzINnYkA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDulhIitogPjPie+TeI5aCqWYoPFgKpq/BoJaamYmvbzQIgC6bNYErTte3DnMxGlxQ9FH1wqlvkLix8NUdy0c6J4pM="}]},"maintainers":[{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"}],"directories":{}},"0.7.0":{"name":"stencil-js","description":"Async JavaScript Templating","version":"0.7.0","author":{"name":"Andy VanWagoner","email":"thetalecrafter@gmail.com"},"keywords":["stencil","template","view","asynchronous"],"repository":{"type":"git","url":"git://github.com/thetalecrafter/stencil.git"},"main":"stencil","engines":{"node":"*"},"readme":"# stencil\n\nstencil is a templating engine designed by Andy VanWagoner\n([thetalecrafter](http://github.com/thetalecrafter))\nto enable templates to run in an environment with asynchronous I/O,\nsuch as [node](http://nodejs.org), as well as in the browser.\n\nWhile there have been many other libraries with the same claims,\nall of the ones currently maintained use the mustache syntax,\nwhile this uses asp / erb / php style syntax.\n\n## Features\n\n  * Async nested templates\n  * Async tag to ensure template is processed sequentially\n  * Use the same template code both server and client side\n\n\n## Shared templates\n\nThe motivator for stencil was to share templates between server and client code.\nThe template can be used server side to generate a widget in the initial page load,\nand then the template can be included on the page to update the widget.\n\nThe code to generate and update a widget can be the same file.\n\n\n## Usage - template code\n\nTemplates are specified using php/asp syntax, with code inside special tags.\nBy default the tags are php-style:\n\n```php\n<? javascript code here ?>\n```\n\nThere are also suffixes to the opening tag for ouput, include, and async blocks.\n\n```php\n<?= 'Today is ' + (new Date()) // result is html encoded and included in output ?>\n<?= 'hello', ' ', 'world' // multiple results can be output ?>\n<?- '<em>Important</em>' // This output won't be encoded ?>\n\n<?# 'child-template-id' // result passed as id to include() ?>\n<?# { id:'child', async:'~' }, { custom:'data' } // override options and data variables in child template ?>\n\n<?! setTimeout(next, 1000); // functionally equivalent to php sleep(1) ?>\n<?! someAsyncFunction(param1, function whendone(result) {\n\t\t// do stuff with result\n\t\tprint(result);\n\t\tnext(); // continue processing the rest of the template\n\t}); ?>\n```\n\nMembers of the data object are put in the scope of the template code:\n\n```html\n<script type=\"text/template\" id=\"template\"><[CDATA[\n\tWhy I don't teach English anymore:\n\t<?= message ?>.\n]]></script>\n<script>\n\tstencil({ id:'template' }, { message:'The book is not on the table' },\n\t\tfunction(err, result) {\n\t\t\tif (err) return console.log('The template failed to run.');\n\t\t\tconsole.log('The template result was:' + result);\n\t\t}\n\t);\n</script>\n```\n\n\nImportant note:\n\nUnlike regular code tags, async tags cannot not include partial statements.\nAll of the code inside will be wrapped into a function.\nAll of the code following will also be wrapped into a function.\n\nThis would not work:\n\n```php\n<?! if (true) { ?>some output<? } ?>\n```\n\nSince compiled it would be similar to:\n\n```javascript\n(function(next){ if (true) { })(function() { print('some output'); } });\n```\n\n\n## Usage - client side\n\n```html\n<script src=\"stencil.js\"></script>\n<script type=\"text/template\" id=\"dom_id\">\n\t<[CDATA[\n\t... template code here ...\n\t]]>\n</script>\n<script>\n\tstencil.compile({ id:'dom_id' }, function(err, template) {\n\t\ttemplate(\n\t\t\t{ data:object },\n\t\t\tfunction(data) { /* optional - use the data chunks */ },\n\t\t\tfunction(err, result) { /* all done */ },\n\t\t);\n\t});\n\n\t// or\n\n\tstencil('dom_id', { data:object }, function(err, result) {\n\t\t/* all done */ \n\t\tif (err) { /* you broke it */ return; }\n\t\t/* use the result */\n\t});\n</script>\n```\n\n\n## Usage - server side\n\n```javascript\nvar stencil = require('./stencil');\n\nstencil('/path/to/template', { data:object },\n\tfunction(data) { /* use the data chunks */ },\n\tfunction(err, result) { /* all done */ }\n);\n\n// same variations apply as client side.\n```\n\n\n## Usage - custom tags\n\n```javascript\n\n// override defaults for this template\nstencil({\n\tid:    id,\n\tstart: '`',\n\tstop:  '`',\n\techo:  'print',\n\tsafe:  'encode',\n\tnest:  ' include this template:',\n\tasync: '@'\n}, data, function(err, result) {\n\t// here's my result\n});\n\n// or for all templates\nstencil.defaults.start = '`';\nstencil.defaults.stop  = '`';\n...\n\n// template code:\nMy pet is `if (hungry) { `hungry` } else { `sleepy` }`.\nHis name is: `print pet.name`.\nHe looks like: ` include this template: 'looks_like', pet `.\n`@my_async_function(function(result) { print(result); next(); });`\nthe end.\n```\n\n\n## Usage - extras\n\nYou can fetch templates synchronously, if you need to. The caveat here\nis that you cannot do anything asynchronous in your template, or\nyou will only get the ouput up until the first asynchronous part. The setting\nreally only makes includes happen synchronously.\n\n```javascript\ntry { var result = stencil({ id:'id', sync_include:true }, data); }\ncatch (err) { /* You broke it. */ }\n```\n\nOr if you have don't get the template by dom id, ajax call, (or by filename\nin node), you can pass in the 'fetch' option a function that retrieves\nthe template text and has this signature: (stencil_options, next(error, text))\n\n\nYou can also compile templates without a 'with' statement, by including a\nreference to uglify-js's parse function. This will improve the rendering\nperformance, but is expensive at compile time.\n\n```javascript\nstencil.compile({ id:'id', parse:require('uglify-js').parser.parse }, function(err, fn) {\n\t// fn does not use the 'with' statement\n})\n```\n\nRemoving the 'with' statement also means all variables in your template\nare declared with 'var', so you can't create implicit globals, and you\nwon't get errors by using a context variable that wasn't passed in.\n\n```php\n<?\n\t// data passed in does not contain either variable\n\tbogus_var = 'bogus'; // won't implicitly create a global\n\tif (maybe_var) { // won't throw an error\n\t\t/* use maybe_var */\n\t}\n?>\n```\n\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 Andy VanWagoner\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"stencil-js@0.7.0","dist":{"shasum":"f133dd96b6c0efe50e54cd17d833dd6b0672b884","tarball":"https://registry.npmjs.org/stencil-js/-/stencil-js-0.7.0.tgz","integrity":"sha512-4WiLb78vjcexu38gvYClH9CZKDm9H1bM1agVR5eOPRiniZLcjYCStVHSbspYtifL+g2re5uuPnkF1ok/tWDqqQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCNoBqHl7N7kdUidZywp4QlLP2d6XKWANUGpIzLZ8H2AwIgNQvdfpWtG/BA4bIcHWNZVPFiqdzKW7KNwonpP4AC6JQ="}]},"_npmVersion":"1.1.49","_npmUser":{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"},"maintainers":[{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"}],"directories":{}},"0.7.1":{"name":"stencil-js","description":"Async JavaScript Templating","version":"0.7.1","author":{"name":"Andy VanWagoner","email":"thetalecrafter@gmail.com"},"keywords":["stencil","template","view","asynchronous"],"repository":{"type":"git","url":"git://github.com/thetalecrafter/stencil.git"},"main":"stencil","engines":{"node":"*"},"readme":"# stencil\n\nstencil is a templating engine designed by Andy VanWagoner\n([thetalecrafter](http://github.com/thetalecrafter))\nto enable templates to run in an environment with asynchronous I/O,\nsuch as [node](http://nodejs.org), as well as in the browser.\n\nWhile there have been many other libraries with the same claims,\nall of the ones currently maintained use the mustache syntax,\nwhile this uses asp / erb / php style syntax.\n\n## Features\n\n  * Async nested templates\n  * Async tag to ensure template is processed sequentially\n  * Use the same template code both server and client side\n\n\n## Shared templates\n\nThe motivator for stencil was to share templates between server and client code.\nThe template can be used server side to generate a widget in the initial page load,\nand then the template can be included on the page to update the widget.\n\nThe code to generate and update a widget can be the same file.\n\n\n## Usage - template code\n\nTemplates are specified using php/asp syntax, with code inside special tags.\nBy default the tags are php-style:\n\n```php\n<? javascript code here ?>\n```\n\nThere are also suffixes to the opening tag for ouput, include, and async blocks.\n\n```php\n<?= 'Today is ' + (new Date()) /* result is html encoded and included in output */ ?>\n<?= 'hello', ' ', 'world' /* multiple results can be output */ ?>\n<?- '<em>Important</em>' /* This output won't be encoded */ ?>\n\n<?# 'child-template-id' /* result passed as id to include() */ ?>\n<?# { id:'child', async:'~' }, { custom:'data' } /* override options and data variables in child template */ ?>\n\n<?! setTimeout(next, 1000); /* functionally equivalent to php sleep(1) */ ?>\n<?! someAsyncFunction(param1, function whendone(result) {\n\t\t// do stuff with result\n\t\tprint(result);\n\t\tnext(); // continue processing the rest of the template\n\t}); ?>\n```\n\nMembers of the data object are put in the scope of the template code:\n\n```html\n<script type=\"text/template\" id=\"template\"><[CDATA[\n\tWhy I don't teach English anymore:\n\t<?= message ?>.\n]]></script>\n<script>\n\tstencil({ id:'template' }, { message:'The book is not on the table' },\n\t\tfunction(err, result) {\n\t\t\tif (err) return console.log('The template failed to run.');\n\t\t\tconsole.log('The template result was:' + result);\n\t\t}\n\t);\n</script>\n```\n\n\nImportant note:\n\nUnlike regular code tags, async tags cannot not include partial statements.\nAll of the code inside will be wrapped into a function, and will be executed\nafter the main block completes.\n\nThis would not work:\n\n```php\n<?! if (true) { ?>some output<? } ?>\n```\n\nSince compiled it would be similar to:\n\n```javascript\nasync(function(next){ if (true) { }); print('some output'); }\n```\n\n```php\n<? alert('This executes first'); ?>\n<?! alert('This executes third, after the main block completes'); next(); ?>\n<?! alert('fourth'); next(); ?>\n<? alert('second'); ?>\n```\n\n\n## Usage - client side\n\n```html\n<script src=\"stencil.js\"></script>\n<script type=\"text/template\" id=\"dom_id\">\n\t<[CDATA[\n\t... template code here ...\n\t]]>\n</script>\n<script>\n\tstencil('dom_id', { data:object }, function(err, result) {\n\t\t/* all done */ \n\t\tif (err) { /* you broke it */ return; }\n\t\t/* use the result */\n\t});\n\n\t// or\n\n\tstencil.fetch({ id:'dom_id' }, function(err, template) {\n\t\ttemplate = stencil.compile(template, { async:'~' });\n\t\ttemplate(\n\t\t\t{ data:object },\n\t\t\tfunction(data) { /* optional - use the data chunks */ },\n\t\t\tfunction(err, result) { /* all done */ },\n\t\t);\n\t});\n</script>\n```\n\n\n## Usage - server side\n\n```javascript\nvar stencil = require('./stencil');\n\nstencil('/path/to/template', { data:object },\n\tfunction(data) { /* use the data chunks */ },\n\tfunction(err, result) { /* all done */ }\n);\n\n// same variations apply as client side.\n```\n\n\n## Usage - custom tags\n\n```javascript\n\n// override defaults for this template\nstencil({\n\tid:    id,\n\tstart: '`',\n\tstop:  '`',\n\techo:  'print',\n\tsafe:  'encode',\n\tnest:  ' include this template:',\n\tasync: '@'\n}, data, function(err, result) {\n\t// here's my result\n});\n\n// or for all templates\nstencil.defaults.start = '`';\nstencil.defaults.stop  = '`';\n...\n\n// template code:\nMy pet is `if (hungry) { `hungry` } else { `sleepy` }`.\nHis name is: `print pet.name`.\nHe looks like: ` include this template: 'looks_like', pet `.\n`@my_async_function(function(result) { print(result); next(); });`\nthe end.\n```\n\n\n## Usage - extras\n\nYou can fetch templates synchronously, if you need to. The caveat here\nis that you cannot do anything asynchronous in your template, or\nyou will only get the ouput up until the first asynchronous part. The setting\nreally only makes includes happen synchronously.\n\n```javascript\ntry { var result = stencil({ id:'id', sync_include:true }, data); }\ncatch (err) { /* You broke it. */ }\n```\n\nOr if you have don't get the template by dom id, ajax call, (or by filename\nin node), you can pass in the 'fetch' option a function that retrieves\nthe template text and has this signature: (stencil_options, next(error, text))\n\n\nYou can also compile templates without a 'with' statement, by including a\nreference to uglify-js's parse function. This will improve the rendering\nperformance, but is expensive at compile time.\n\n```javascript\n// fn does not use the 'with' statement, but still can't \"use strict\";\nvar fn = stencil.compile(source, { parse:require('uglify-js').parser.parse });\n\nstencil.defaults.parse = require('uglify-js').parser.parse;\nstencil({ id:'id' }, function(err, result) {\n\t// result achieved without 'with'\n});\n\nstencil.defaults.parse = function(){ return []; };\nstencil({ id:'id' }, function(err, result) {\n\t// no 'with', but names were not properly identified, so the template\n\t//  code would have to prefix data members with `context.`\n});\n```\n\nRemoving the 'with' statement also means all variables in your template\nare declared with 'var', so you can't create implicit globals, and you\nwon't get errors by using a context variable that wasn't passed in.\n\n```php\n<?\n\t// data passed in does not contain either variable\n\tbogus_var = 'bogus'; // won't implicitly create a global\n\tif (maybe_var) { // won't throw an error\n\t\t/* use maybe_var */\n\t}\n?>\n```\n\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 Andy VanWagoner\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"stencil-js@0.7.1","dist":{"shasum":"3eb1651ba5fddfae4a911f6d666bc9253a4fa38b","tarball":"https://registry.npmjs.org/stencil-js/-/stencil-js-0.7.1.tgz","integrity":"sha512-aquMp1U6xfK1TJVbcqaYuLT5pOeQB2mR0ETgMBCQ7tiSA83YaA6WB0DO/+7i3xxHP+ODHeIFdykw/rTW0TXTNQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD8M9VlJDuo5Erx7nxdsx/LmuCamuB5jG0f1BU6Avt1nwIhAMKn13h2tsYxwhHDbYGFqLuJf9pmyTcJZQFyZdllGpP0"}]},"maintainers":[{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"}],"directories":{}},"0.7.2":{"name":"stencil-js","description":"Async JavaScript Templating","version":"0.7.2","author":{"name":"Andy VanWagoner","email":"thetalecrafter@gmail.com"},"keywords":["stencil","template","view","asynchronous"],"repository":{"type":"git","url":"git://github.com/thetalecrafter/stencil.git"},"main":"stencil","engines":{"node":"*"},"readme":"# stencil\n\nstencil is a templating engine designed by Andy VanWagoner\n([thetalecrafter](http://github.com/thetalecrafter))\nto enable templates to run in an environment with asynchronous I/O,\nsuch as [node](http://nodejs.org), as well as in the browser.\n\nWhile there have been many other libraries with the same claims,\nall of the ones currently maintained use the mustache syntax,\nwhile this uses asp / erb / php style syntax.\n\n## Features\n\n  * Async nested templates\n  * Async tag to ensure template is processed sequentially\n  * Use the same template code both server and client side\n\n\n## Shared templates\n\nThe motivator for stencil was to share templates between server and client code.\nThe template can be used server side to generate a widget in the initial page load,\nand then the template can be included on the page to update the widget.\n\nThe code to generate and update a widget can be the same file.\n\n\n## Usage - template code\n\nTemplates are specified using php/asp syntax, with code inside special tags.\nBy default the tags are php-style:\n\n```php\n<? javascript code here ?>\n```\n\nThere are also suffixes to the opening tag for ouput, include, and async blocks.\n\n```php\n<?= 'Today is ' + (new Date()) /* result is html encoded and included in output */ ?>\n<?= 'hello', ' ', 'world' /* multiple results can be output */ ?>\n<?- '<em>Important</em>' /* This output won't be encoded */ ?>\n\n<?# 'child-template-id' /* result passed as id to include() */ ?>\n<?# { id:'child', async:'~' }, { custom:'data' } /* override options and data variables in child template */ ?>\n\n<?! setTimeout(next, 1000); /* functionally equivalent to php sleep(1) */ ?>\n<?! someAsyncFunction(param1, function whendone(result) {\n\t\t// do stuff with result\n\t\tprint(result);\n\t\tnext(); // continue processing the rest of the template\n\t}); ?>\n```\n\nMembers of the data object are put in the scope of the template code:\n\n```html\n<script type=\"text/template\" id=\"template\"><[CDATA[\n\tWhy I don't teach English anymore:\n\t<?= message ?>.\n]]></script>\n<script>\n\tstencil({ id:'template' }, { message:'The book is not on the table' },\n\t\tfunction(err, result) {\n\t\t\tif (err) return console.log('The template failed to run.');\n\t\t\tconsole.log('The template result was:' + result);\n\t\t}\n\t);\n</script>\n```\n\n\nImportant note:\n\nUnlike regular code tags, async tags cannot not include partial statements.\nAll of the code inside will be wrapped into a function, and will be executed\nafter the main block completes.\n\nThis would not work:\n\n```php\n<?! if (true) { ?>some output<? } ?>\n```\n\nSince compiled it would be similar to:\n\n```javascript\nasync(function(next){ if (true) { }); print('some output'); }\n```\n\n```php\n<? alert('This executes first'); ?>\n<?! alert('This executes third, after the main block completes'); next(); ?>\n<?! alert('fourth'); next(); ?>\n<? alert('second'); ?>\n```\n\n\n## Usage - client side\n\n```html\n<script src=\"stencil.js\"></script>\n<script type=\"text/template\" id=\"dom_id\">\n\t<[CDATA[\n\t... template code here ...\n\t]]>\n</script>\n<script>\n\tstencil('dom_id', { data:object }, function(err, result) {\n\t\t/* all done */ \n\t\tif (err) { /* you broke it */ return; }\n\t\t/* use the result */\n\t});\n\n\t// or\n\n\tstencil.fetch({ id:'dom_id' }, function(err, template) {\n\t\ttemplate = stencil.compile(template, { async:'~' });\n\t\ttemplate(\n\t\t\t{ data:object },\n\t\t\tfunction(data) { /* optional - use the data chunks */ },\n\t\t\tfunction(err, result) { /* all done */ },\n\t\t);\n\t});\n</script>\n```\n\n\n## Usage - server side\n\n```javascript\nvar stencil = require('./stencil');\n\nstencil('/path/to/template', { data:object },\n\tfunction(data) { /* use the data chunks */ },\n\tfunction(err, result) { /* all done */ }\n);\n\n// same variations apply as client side.\n```\n\n\n## Usage - custom tags\n\n```javascript\n\n// override defaults for this template\nstencil({\n\tid:    id,\n\tstart: '`',\n\tstop:  '`',\n\techo:  'print',\n\tsafe:  'encode',\n\tnest:  ' include this template:',\n\tasync: '@'\n}, data, function(err, result) {\n\t// here's my result\n});\n\n// or for all templates\nstencil.defaults.start = '`';\nstencil.defaults.stop  = '`';\n...\n\n// template code:\nMy pet is `if (hungry) { `hungry` } else { `sleepy` }`.\nHis name is: `print pet.name`.\nHe looks like: ` include this template: 'looks_like', pet `.\n`@my_async_function(function(result) { print(result); next(); });`\nthe end.\n```\n\n\n## Usage - extras\n\nYou can fetch templates synchronously, if you need to. The caveat here\nis that you cannot do anything asynchronous in your template, or\nyou will only get the ouput up until the first asynchronous part. The setting\nreally only makes includes happen synchronously.\n\n```javascript\ntry { var result = stencil({ id:'id', sync_include:true }, data); }\ncatch (err) { /* You broke it. */ }\n```\n\nOr if you have don't get the template by dom id, ajax call, (or by filename\nin node), you can pass in the 'fetch' option a function that retrieves\nthe template text and has this signature: (stencil_options, next(error, text))\n\n\nYou can also compile templates without a 'with' statement, by including a\nreference to uglify-js's parse function. This will improve the rendering\nperformance, but is expensive at compile time.\n\n```javascript\n// fn does not use the 'with' statement, but still can't \"use strict\";\nvar fn = stencil.compile(source, { parse:require('uglify-js').parser.parse });\n\nstencil.defaults.parse = require('uglify-js').parser.parse;\nstencil({ id:'id' }, function(err, result) {\n\t// result achieved without 'with'\n});\n\nstencil.defaults.parse = function(){ return []; };\nstencil({ id:'id' }, function(err, result) {\n\t// no 'with', but names were not properly identified, so the template\n\t//  code would have to prefix data members with `context.`\n});\n```\n\nRemoving the 'with' statement also means all variables in your template\nare declared with 'var', so you can't create implicit globals, and you\nwon't get errors by using a context variable that wasn't passed in.\n\n```php\n<?\n\t// data passed in does not contain either variable\n\tbogus_var = 'bogus'; // won't implicitly create a global\n\tif (maybe_var) { // won't throw an error\n\t\t/* use maybe_var */\n\t}\n?>\n```\n\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 Andy VanWagoner\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"stencil-js@0.7.2","dist":{"shasum":"84a16c2330f8ca28d5b9504285bae431f99265cb","tarball":"https://registry.npmjs.org/stencil-js/-/stencil-js-0.7.2.tgz","integrity":"sha512-gEOs/hA6J/bM/7rDOqy/DzkuQ+2og7O4F2rGdAHZrErFKV0jBQBXOvE6hnJyKTkMizTDTCCcrF0m7oa33+jUNg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCYeONOWWu0J2x19OHb6lZYmToDIuSoG3NIzOvplHt9yAIgFTDW9eHJGzrgPd+taqBQJD+ltFnN7iXNboZxUbVAKL4="}]},"maintainers":[{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"}],"directories":{}},"0.8.0":{"name":"stencil-js","description":"Async JavaScript Templating","version":"0.8.0","author":{"name":"Andy VanWagoner","email":"thetalecrafter@gmail.com"},"keywords":["stencil","template","view","asynchronous"],"repository":{"type":"git","url":"git://github.com/thetalecrafter/stencil.git"},"main":"stencil","engines":{"node":"*"},"readme":"# stencil\n\nstencil is a templating engine designed by Andy VanWagoner\n([thetalecrafter](http://github.com/thetalecrafter))\nto enable templates to run in an environment with asynchronous I/O,\nsuch as [node](http://nodejs.org), as well as in the browser.\n\nIf [ejs](https://github.com/visionmedia/ejs) suites your needs,\nyou should probably use that as it is better tested and is likely\nmore robust. However, stencil includes a few things that ejs\ndoes't yet.\n\n## Features\n\n  * Async tag to ensure template is processed sequentially\n  * Use the same template code both server and client side\n  * Generate function as a string on server for use on the client\n  * Choose to include \"use strict\"; or with(data) {...}\n  * Line numbers in generated code match original template\n\n\n## Usage - template code\n\nTemplates are specified using php/asp syntax, with code inside special tags.\nThere are also suffixes to the opening tag for print and async blocks.\nBy default the tags are php-style:\n\n```php\n<? javascript code here ?>\n<?= 'Today is ' + (new Date()) /* result is html encoded and included in output */ ?>\n<?= 'hello', ' ', 'world' /* multiple results can be output */ ?>\n<?- '<em>Important</em>' /* This output won't be encoded */ ?>\n\n<?! setTimeout(next, 1000); /* functionally equivalent to php sleep(1) */ !?>\n<?! someAsyncFunction(param1, function whendone(result) {\n\t\t// do stuff with result\n\t\tprint(result);\n\t\tnext(); // continue processing the rest of the template\n\t}); !?>\n```\n\nMembers of the data object are optionally put in the scope of the template code:\n\n```html\n<script type=\"text/template\" id=\"template\"><\n\tWhy I don't teach English anymore:\n\t<?= message ?>.\n</script>\n<script>\n\tstencil({\n\t\tid: 'template',\n\t\tsrc: document.getElementById('sub').innerHTML,\n\t\tstrict: false /* tells stencil to include a with(data) statement */\n\t}, { message:'The book is not on the table' },\n\t\tfunction(err, result) {\n\t\t\tif (err) return console.log('The template failed to run.');\n\t\t\tconsole.log('The template result was:' + result);\n\t\t}\n\t);\n</script>\n```\n\nWhile nested templates are not built into the language it is easy to do so\nwith a small amount of custom code:\n\n```javascript\n// client (no async done in sub)\n\t<?- stencil(document.getElementById('sub').innerHTML, $) ?>\n// server (sub can have async blocks)\n\t<?! fs.readFile('sub', 'utf8', function(err, tpl) {\n\t\tif (err) return next(err);\n\t\tstencil(tpl, $, next);\n\t}); !?>\n```\n\n\nImportant note:\n\nMake careful to put async blocks end tags at the same nesting level as the start.\nAll of the code inside will be wrapped into a function, and will be executed\nafter the main block completes.\n\n```php\n<?! if (works) { ?>a-okay<? } next(); !?>\n<?! if (!works) { !?>broken<? } next(); ?>\n```\n\nLooks something like this after it is compiled:\n\n```javascript\nasync(function(){ if (works) { print('a-okay'); } next(); });\nasync(function(){ if (!works) { }); print('broken'); } next();\n```\n\n```php\n<? alert('1'); print('1'); ?>\n<?! alert('3'); print('2'); next(); !?>\n<?! alert('4'); print('3'); next(); !?>\n<? alert('2'); print('4'); ?>\n// alerts 1 then 2 then 3 then 4\n// prints 1234\n```\n\n\n## Usage\n\n`stencil(options, data, onprint, oncomplete)` returns output if no async blocks were used\n\n`options` can be a template string or an object with these properties:\n* `id` - usually the filename or uri, used for caching the resulting function for subsequent runs\n* `src` - the template string\n* `start` - default '<?', start tag in the template\n* `stop` - default '?>', stop tag in the template\n* `echo` - default '-', suffix for echoing result of the expression\n* `safe` - default '=', suffix for echoing result of the expression html encoded\n* `async` - default '!', suffix for async blocks, Output is still in document order\n* `strict` - default true, start function with `\"use strict\";` or wrap function in `with(dataVar) {}`\n* `dataVar` - default '$', name of object parameter containing data mambers to use in execution\n* `chunkVar` - default '\\u03B9', name of function parameter called when each chunk is ready\n* `doneVar` - default '\\u03DD', name of function parameter called when output is complete\n* `outputVar` - default '\\u03A3', name of string used to hold the output\n* `safeVar` - default 'escape', name of function used to encode html characters\n* `echoVar` - default 'print', name of function used to output strings\n* `asyncVar` - default '\\u03BB', name of function used internally on async blocks\n* `nextVar` - default 'next', name of function to call when done with async block\n\n`data` object containing values to use in template execution\n\n`onprint(chunk)` - optional - function called for each chunk of output as it becomes ready\n\n`oncomplete(err, output)` function called when template has completed\n\n\n`stencil(options)` or `stencil.compile(options, string)` returns compiled function\n\n`options` template string or options, see above\n\n`string` - optional - if true, return compiled function as a string instead\n\n\n## Usage - client side\n\n```html\n<script src=\"stencil.js\"></script>\n<script type=\"text/template\" id=\"dom_id\">\n\t... template code here ...\n</script>\n<script>\n\tstencil(document.getElementById('dom_id').innerHTML,\n\t\t{ /*data*/ }, function(err, result) {\n\t\t/* all done */ \n\t\tif (err) { /* you broke it */ return; }\n\t\t/* use the result */\n\t});\n</script>\n```\n\n\n## Usage - server side\n\n```javascript\nvar stencil = require('./stencil');\n\nstencil('Hello <?- $.whom ?>!', { whom:'World' },\n\tfunction(data) { /* use the data chunks */ },\n\tfunction(err, result) { /* all done */ }\n);\n```\n\n\n## Usage - custom tags\n\n```javascript\n\n// override defaults for this template\nstencil({\n\tid:    id,\n\tstart: '`',\n\tstop:  '`',\n\techo:  'print',\n\tsafe:  'encode',\n\tasync: '@'\n}, data, function(err, result) {\n\t// here's my result\n});\n\n// or for all templates\nstencil.defaults.start = '`';\nstencil.defaults.stop  = '`';\n...\n\n// template code:\nMy pet is `if (hungry) { `hungry` } else { `sleepy` }`.\nHis name is: `print pet.name`.\n`@my_async_function(function(result) { print(result); next(); });`\nthe end.\n```\n\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 Andy VanWagoner\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"stencil-js@0.8.0","dist":{"shasum":"843c17466aad141aa2019fdd65bdfec0fc47c693","tarball":"https://registry.npmjs.org/stencil-js/-/stencil-js-0.8.0.tgz","integrity":"sha512-8+NISpDBW0xljfKIPUiNJrfQAsHM3L5Rkqr+B+yqMwuuAYDwbK/jU0JY5kYqR3vt0H/0XeLLcYV8zXyO0mvwjA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC5Og5dr8pY/kaEUJiLDy0yaxeC6cXl86DUnJzDZeoJXAIhAPtvB5+NVsFdB83VQMPFnDJcAs4b1SoUhkw6Fl6E4Rt5"}]},"maintainers":[{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"}]},"0.8.1":{"name":"stencil-js","description":"Async JavaScript Templating","version":"0.8.1","author":{"name":"Andy VanWagoner","email":"thetalecrafter@gmail.com"},"keywords":["stencil","template","view","asynchronous"],"repository":{"type":"git","url":"git://github.com/thetalecrafter/stencil.git"},"main":"stencil","engines":{"node":"*"},"readme":"# stencil\n\nstencil is a templating engine designed by Andy VanWagoner\n([thetalecrafter](http://github.com/thetalecrafter))\nto enable templates to run in an environment with asynchronous I/O,\nsuch as [node](http://nodejs.org), as well as in the browser.\n\nIf [ejs](https://github.com/visionmedia/ejs) suites your needs,\nyou should probably use that as it is better tested and is likely\nmore robust. However, stencil includes a few things that ejs\ndoes't yet.\n\n## Features\n\n  * Async tag to ensure template is processed sequentially\n  * Use the same template code both server and client side\n  * Generate function as a string on server for use on the client\n  * Choose to include \"use strict\"; or with(data) {...}\n  * Line numbers in generated code match original template\n\n\n## Usage - template code\n\nTemplates are specified using php/asp syntax, with code inside special tags.\nThere are also suffixes to the opening tag for print and async blocks.\nBy default the tags are php-style:\n\n```php\n<? javascript code here ?>\n<?= 'Today is ' + (new Date()) /* result is html encoded and included in output */ ?>\n<?= 'hello', ' ', 'world' /* multiple results can be output */ ?>\n<?- '<em>Important</em>' /* This output won't be encoded */ ?>\n\n<?! setTimeout(next, 1000); /* functionally equivalent to php sleep(1) */ !?>\n<?! someAsyncFunction(param1, function whendone(result) {\n\t\t// do stuff with result\n\t\tprint(result);\n\t\tnext(); // continue processing the rest of the template\n\t}); !?>\n```\n\nMembers of the data object are optionally put in the scope of the template code:\n\n```html\n<script type=\"text/template\" id=\"template\"><\n\tWhy I don't teach English anymore:\n\t<?= message ?>.\n</script>\n<script>\n\tstencil({\n\t\tid: 'template',\n\t\tsrc: document.getElementById('sub').innerHTML,\n\t\tstrict: false /* tells stencil to include a with(data) statement */\n\t}, { message:'The book is not on the table' },\n\t\tfunction(err, result) {\n\t\t\tif (err) return console.log('The template failed to run.');\n\t\t\tconsole.log('The template result was:' + result);\n\t\t}\n\t);\n</script>\n```\n\nWhile nested templates are not built into the language it is easy to do so\nwith a small amount of custom code:\n\n```javascript\n// client (no async done in sub)\n\t<?- stencil(document.getElementById('sub').innerHTML, $) ?>\n// server (sub can have async blocks)\n\t<?! fs.readFile('sub', 'utf8', function(err, tpl) {\n\t\tif (err) return next(err);\n\t\tstencil(tpl, $, next);\n\t}); !?>\n```\n\n\nImportant note:\n\nMake careful to put async blocks end tags at the same nesting level as the start.\nAll of the code inside will be wrapped into a function, and will be executed\nafter the main block completes.\n\n```php\n<?! if (works) { ?>a-okay<? } next(); !?>\n<?! if (!works) { !?>broken<? } next(); ?>\n```\n\nLooks something like this after it is compiled:\n\n```javascript\nasync(function(){ if (works) { print('a-okay'); } next(); });\nasync(function(){ if (!works) { }); print('broken'); } next();\n```\n\n```php\n<? alert('1'); print('1'); ?>\n<?! alert('3'); print('2'); next(); !?>\n<?! alert('4'); print('3'); next(); !?>\n<? alert('2'); print('4'); ?>\n// alerts 1 then 2 then 3 then 4\n// prints 1234\n```\n\n\n## Usage\n\n`stencil(options, data, onprint, oncomplete)` returns output if no async blocks were used\n\n`options` can be a template string or an object with these properties:\n* `id` - usually the filename or uri, used for caching the resulting function for subsequent runs\n* `src` - the template string\n* `start` - default '<?', start tag in the template\n* `stop` - default '?>', stop tag in the template\n* `echo` - default '-', suffix for echoing result of the expression\n* `safe` - default '=', suffix for echoing result of the expression html encoded\n* `async` - default '!', suffix for async blocks, Output is still in document order\n* `strict` - default true, start function with `\"use strict\";` or wrap function in `with(dataVar) {}`\n* `dataVar` - default '$', name of object parameter containing data mambers to use in execution\n* `chunkVar` - default '\\u03B9', name of function parameter called when each chunk is ready\n* `doneVar` - default '\\u03DD', name of function parameter called when output is complete\n* `outputVar` - default '\\u03A3', name of string used to hold the output\n* `safeVar` - default 'escape', name of function used to encode html characters\n* `echoVar` - default 'print', name of function used to output strings\n* `asyncVar` - default '\\u03BB', name of function used internally on async blocks\n* `nextVar` - default 'next', name of function to call when done with async block\n\n`data` object containing values to use in template execution\n\n`onprint(chunk)` - optional - function called for each chunk of output as it becomes ready\n\n`oncomplete(err, output)` function called when template has completed\n\n\n`stencil(options)` or `stencil.compile(options, string)` returns compiled function\n\n`options` template string or options, see above\n\n`string` - optional - if true, return compiled function as a string instead\n\n\n## Usage - client side\n\n```html\n<script src=\"stencil.js\"></script>\n<script type=\"text/template\" id=\"dom_id\">\n\t... template code here ...\n</script>\n<script>\n\tstencil(document.getElementById('dom_id').innerHTML,\n\t\t{ /*data*/ }, function(err, result) {\n\t\t/* all done */ \n\t\tif (err) { /* you broke it */ return; }\n\t\t/* use the result */\n\t});\n</script>\n```\n\n\n## Usage - server side\n\n```javascript\nvar stencil = require('./stencil');\n\nstencil('Hello <?- $.whom ?>!', { whom:'World' },\n\tfunction(data) { /* use the data chunks */ },\n\tfunction(err, result) { /* all done */ }\n);\n```\n\n\n## Usage - custom tags\n\n```javascript\n\n// override defaults for this template\nstencil({\n\tid:    id,\n\tstart: '`',\n\tstop:  '`',\n\techo:  'print',\n\tsafe:  'encode',\n\tasync: '@'\n}, data, function(err, result) {\n\t// here's my result\n});\n\n// or for all templates\nstencil.defaults.start = '`';\nstencil.defaults.stop  = '`';\n...\n\n// template code:\nMy pet is `if (hungry) { `hungry` } else { `sleepy` }`.\nHis name is: `print pet.name`.\n`@my_async_function(function(result) { print(result); next(); });`\nthe end.\n```\n\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 Andy VanWagoner\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"stencil-js@0.8.1","dist":{"shasum":"525f34080e2586e2c47cccd5c75234e56d9734a8","tarball":"https://registry.npmjs.org/stencil-js/-/stencil-js-0.8.1.tgz","integrity":"sha512-IwbibZ3nBU54wNoUZIzDmXh54h2Mz7zH4vRonubMiyHSYFuXL47JvCw4fjhnwZXBcEj6ucZKkbvK/VKKZdW+Hg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDdCf+yN2P3SUt7DZ8SY2eLiqPjCSWgkzI4nUvHdlQSowIgLE+UtUFsMNMKgChlj+fG0POr4pQbF7DbmZx3lBt/DGI="}]},"_npmVersion":"1.1.59","_npmUser":{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"},"maintainers":[{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"}]},"0.8.2":{"name":"stencil-js","description":"Async JavaScript Templating","version":"0.8.2","author":{"name":"Andy VanWagoner","email":"thetalecrafter@gmail.com"},"keywords":["stencil","template","view","asynchronous"],"repository":{"type":"git","url":"git://github.com/thetalecrafter/stencil.git"},"main":"stencil","engines":{"node":"*"},"readme":"# stencil\n\nstencil is a templating engine designed by Andy VanWagoner\n([thetalecrafter](http://github.com/thetalecrafter))\nto enable templates to run in an environment with asynchronous I/O,\nsuch as [node](http://nodejs.org), as well as in the browser.\n\nIf [ejs](https://github.com/visionmedia/ejs) suites your needs,\nyou should probably use that as it is better tested and is likely\nmore robust. However, stencil includes a few things that ejs\ndoes't yet.\n\n## Features\n\n  * Async tag to ensure template is processed sequentially\n  * Use the same template code both server and client side\n  * Generate function as a string on server for use on the client\n  * Choose to include \"use strict\"; or with(data) {...}\n  * Line numbers in generated code match original template\n\n\n## Usage - template code\n\nTemplates are specified using php/asp syntax, with code inside special tags.\nThere are also suffixes to the opening tag for print and async blocks.\nBy default the tags are php-style:\n\n```php\n<? javascript code here ?>\n<?= 'Today is ' + (new Date()) /* result is html encoded and included in output */ ?>\n<?= 'hello', ' ', 'world' /* multiple results can be output */ ?>\n<?- '<em>Important</em>' /* This output won't be encoded */ ?>\n\n<?! setTimeout(next, 1000); /* functionally equivalent to php sleep(1) */ !?>\n<?! someAsyncFunction(param1, function whendone(result) {\n\t\t// do stuff with result\n\t\tprint(result);\n\t\tnext(); // continue processing the rest of the template\n\t}); !?>\n```\n\nMembers of the data object are optionally put in the scope of the template code:\n\n```html\n<script type=\"text/template\" id=\"template\"><\n\tWhy I don't teach English anymore:\n\t<?= message ?>.\n</script>\n<script>\n\tstencil({\n\t\tid: 'template',\n\t\tsrc: document.getElementById('sub').innerHTML,\n\t\tstrict: false /* tells stencil to include a with(data) statement */\n\t}, { message:'The book is not on the table' },\n\t\tfunction(err, result) {\n\t\t\tif (err) return console.log('The template failed to run.');\n\t\t\tconsole.log('The template result was:' + result);\n\t\t}\n\t);\n</script>\n```\n\nWhile nested templates are not built into the language it is easy to do so\nwith a small amount of custom code:\n\n```javascript\n// client (no async done in sub)\n\t<?- stencil(document.getElementById('sub').innerHTML, $) ?>\n// server (sub can have async blocks)\n\t<?! fs.readFile('sub', 'utf8', function(err, tpl) {\n\t\tif (err) return next(err);\n\t\tstencil(tpl, $, next);\n\t}); !?>\n```\n\n\nImportant note:\n\nMake careful to put async blocks end tags at the same nesting level as the start.\nAll of the code inside will be wrapped into a function, and will be executed\nafter the main block completes.\n\n```php\n<?! if (works) { ?>a-okay<? } next(); !?>\n<?! if (!works) { !?>broken<? } next(); ?>\n```\n\nLooks something like this after it is compiled:\n\n```javascript\nasync(function(){ if (works) { print('a-okay'); } next(); });\nasync(function(){ if (!works) { }); print('broken'); } next();\n```\n\n```php\n<? alert('1'); print('1'); ?>\n<?! alert('3'); print('2'); next(); !?>\n<?! alert('4'); print('3'); next(); !?>\n<? alert('2'); print('4'); ?>\n// alerts 1 then 2 then 3 then 4\n// prints 1234\n```\n\n\n## Usage\n\n`stencil(options, data, onprint, oncomplete)` returns output if no async blocks were used\n\n`options` can be a template string or an object with these properties:\n* `id` - usually the filename or uri, used for caching the resulting function for subsequent runs\n* `src` - the template string\n* `start` - default '<?', start tag in the template\n* `stop` - default '?>', stop tag in the template\n* `echo` - default '-', suffix for echoing result of the expression\n* `safe` - default '=', suffix for echoing result of the expression html encoded\n* `async` - default '!', suffix for async blocks, Output is still in document order\n* `strict` - default true, start function with `\"use strict\";` or wrap function in `with(dataVar) {}`\n* `dataVar` - default '$', name of object parameter containing data mambers to use in execution\n* `chunkVar` - default '\\u03B9', name of function parameter called when each chunk is ready\n* `doneVar` - default '\\u03DD', name of function parameter called when output is complete\n* `outputVar` - default '\\u03A3', name of string used to hold the output\n* `safeVar` - default 'escape', name of function used to encode html characters\n* `echoVar` - default 'print', name of function used to output strings\n* `asyncVar` - default '\\u03BB', name of function used internally on async blocks\n* `nextVar` - default 'next', name of function to call when done with async block\n\n`data` object containing values to use in template execution\n\n`onprint(chunk)` - optional - function called for each chunk of output as it becomes ready\n\n`oncomplete(err, output)` function called when template has completed\n\n\n`stencil(options)` or `stencil.compile(options, string)` returns compiled function\n\n`options` template string or options, see above\n\n`string` - optional - if true, return compiled function as a string instead\n\n\n## Usage - client side\n\n```html\n<script src=\"stencil.js\"></script>\n<script type=\"text/template\" id=\"dom_id\">\n\t... template code here ...\n</script>\n<script>\n\tstencil(document.getElementById('dom_id').innerHTML,\n\t\t{ /*data*/ }, function(err, result) {\n\t\t/* all done */ \n\t\tif (err) { /* you broke it */ return; }\n\t\t/* use the result */\n\t});\n</script>\n```\n\n\n## Usage - server side\n\n```javascript\nvar stencil = require('./stencil');\n\nstencil('Hello <?- $.whom ?>!', { whom:'World' },\n\tfunction(data) { /* use the data chunks */ },\n\tfunction(err, result) { /* all done */ }\n);\n```\n\n\n## Usage - custom tags\n\n```javascript\n\n// override defaults for this template\nstencil({\n\tid:    id,\n\tstart: '`',\n\tstop:  '`',\n\techo:  'print',\n\tsafe:  'encode',\n\tasync: '@'\n}, data, function(err, result) {\n\t// here's my result\n});\n\n// or for all templates\nstencil.defaults.start = '`';\nstencil.defaults.stop  = '`';\n...\n\n// template code:\nMy pet is `if (hungry) { `hungry` } else { `sleepy` }`.\nHis name is: `print pet.name`.\n`@my_async_function(function(result) { print(result); next(); });`\nthe end.\n```\n\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 Andy VanWagoner\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"stencil-js@0.8.2","dist":{"shasum":"8ceacae9dd32c68676a95c13f8a9a1fb21742e11","tarball":"https://registry.npmjs.org/stencil-js/-/stencil-js-0.8.2.tgz","integrity":"sha512-7GJUX5K3jZgy74AjxaAJ6cFPjmIguYxrXG03jsKQsk59+aYgWGNgDZAvVL/mM3U+Q4OZ1d7ATrzJrswdTEWdjg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDcwCBpSXoRzolTlj7qXtNLLuxe3E0IUSROx1XJ8vZE8wIhAPhfdmiCiPfDENV3vLy+rVMfdUEQ9pbbgQ4baQFOVn6q"}]},"maintainers":[{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"}]},"0.8.3":{"name":"stencil-js","description":"Async JavaScript Templating","version":"0.8.3","author":{"name":"Andy VanWagoner","email":"thetalecrafter@gmail.com"},"keywords":["stencil","template","view","asynchronous"],"repository":{"type":"git","url":"git://github.com/thetalecrafter/stencil.git"},"main":"stencil","engines":{"node":"*"},"readme":"# stencil\n\nstencil is a templating engine designed by Andy VanWagoner\n([thetalecrafter](http://github.com/thetalecrafter))\nto enable templates to run in an environment with asynchronous I/O,\nsuch as [node](http://nodejs.org), as well as in the browser.\n\nIf [ejs](https://github.com/visionmedia/ejs) suites your needs,\nyou should probably use that as it is better tested and is likely\nmore robust. However, stencil includes a few things that ejs\ndoes't yet.\n\n## Features\n\n  * Async tag to ensure template is processed sequentially\n  * Use the same template code both server and client side\n  * Generate function as a string on server for use on the client\n  * Choose to include \"use strict\"; or with(data) {...}\n  * Line numbers in generated code match original template\n\n\n## Usage - template code\n\nTemplates are specified using php/asp syntax, with code inside special tags.\nThere are also suffixes to the opening tag for print and async blocks.\nBy default the tags are php-style:\n\n```php\n<? javascript code here ?>\n<?= 'Today is ' + (new Date()) /* result is html encoded and included in output */ ?>\n<?= 'hello', ' ', 'world' /* multiple results can be output */ ?>\n<?- '<em>Important</em>' /* This output won't be encoded */ ?>\n\n<?! setTimeout(next, 1000); /* functionally equivalent to php sleep(1) */ !?>\n<?! someAsyncFunction(param1, function whendone(result) {\n\t\t// do stuff with result\n\t\tprint(result);\n\t\tnext(); // continue processing the rest of the template\n\t}); !?>\n```\n\nMembers of the data object are optionally put in the scope of the template code:\n\n```html\n<script type=\"text/template\" id=\"template\"><\n\tWhy I don't teach English anymore:\n\t<?= message ?>.\n</script>\n<script>\n\tstencil({\n\t\tid: 'template',\n\t\tsrc: document.getElementById('sub').innerHTML,\n\t\tstrict: false /* tells stencil to include a with(data) statement */\n\t}, { message:'The book is not on the table' },\n\t\tfunction(err, result) {\n\t\t\tif (err) return console.log('The template failed to run.');\n\t\t\tconsole.log('The template result was:' + result);\n\t\t}\n\t);\n</script>\n```\n\nWhile nested templates are not built into the language it is easy to do so\nwith a small amount of custom code:\n\n```javascript\n// client (no async done in sub)\n\t<?- stencil(document.getElementById('sub').innerHTML, $) ?>\n// server (sub can have async blocks)\n\t<?! fs.readFile('sub', 'utf8', function(err, tpl) {\n\t\tif (err) return next(err);\n\t\tstencil(tpl, $, next);\n\t}); !?>\n```\n\n\nImportant note:\n\nMake careful to put async blocks end tags at the same nesting level as the start.\nAll of the code inside will be wrapped into a function, and will be executed\nafter the main block completes.\n\n```php\n<?! if (works) { ?>a-okay<? } next(); !?>\n<?! if (!works) { !?>broken<? } next(); ?>\n```\n\nLooks something like this after it is compiled:\n\n```javascript\nasync(function(){ if (works) { print('a-okay'); } next(); });\nasync(function(){ if (!works) { }); print('broken'); } next();\n```\n\n```php\n<? alert('1'); print('1'); ?>\n<?! alert('3'); print('2'); next(); !?>\n<?! alert('4'); print('3'); next(); !?>\n<? alert('2'); print('4'); ?>\n// alerts 1 then 2 then 3 then 4\n// prints 1234\n```\n\n\n## Usage\n\n`stencil(options, data, onprint, oncomplete)` returns output if no async blocks were used\n\n`options` can be a template string or an object with these properties:\n* `id` - usually the filename or uri, used for caching the resulting function for subsequent runs\n* `src` - the template string\n* `start` - default '<?', start tag in the template\n* `stop` - default '?>', stop tag in the template\n* `echo` - default '-', suffix for echoing result of the expression\n* `safe` - default '=', suffix for echoing result of the expression html encoded\n* `async` - default '!', suffix for async blocks, Output is still in document order\n* `strict` - default true, start function with `\"use strict\";` or wrap function in `with(dataVar) {}`\n* `dataVar` - default '$', name of object parameter containing data mambers to use in execution\n* `chunkVar` - default '\\u03B9', name of function parameter called when each chunk is ready\n* `doneVar` - default '\\u03DD', name of function parameter called when output is complete\n* `outputVar` - default '\\u03A3', name of string used to hold the output\n* `safeVar` - default 'escape', name of function used to encode html characters\n* `echoVar` - default 'print', name of function used to output strings\n* `asyncVar` - default '\\u03BB', name of function used internally on async blocks\n* `nextVar` - default 'next', name of function to call when done with async block\n\n`data` object containing values to use in template execution\n\n`onprint(chunk)` - optional - function called for each chunk of output as it becomes ready\n\n`oncomplete(err, output)` function called when template has completed\n\n\n`stencil(options)` or `stencil.compile(options, string)` returns compiled function\n\n`options` template string or options, see above\n\n`string` - optional - if true, return compiled function as a string instead\n\n\n## Usage - client side\n\n```html\n<script src=\"stencil.js\"></script>\n<script type=\"text/template\" id=\"dom_id\">\n\t... template code here ...\n</script>\n<script>\n\tstencil(document.getElementById('dom_id').innerHTML,\n\t\t{ /*data*/ }, function(err, result) {\n\t\t/* all done */ \n\t\tif (err) { /* you broke it */ return; }\n\t\t/* use the result */\n\t});\n</script>\n```\n\n\n## Usage - server side\n\n```javascript\nvar stencil = require('./stencil');\n\nstencil('Hello <?- $.whom ?>!', { whom:'World' },\n\tfunction(data) { /* use the data chunks */ },\n\tfunction(err, result) { /* all done */ }\n);\n```\n\n\n## Usage - custom tags\n\n```javascript\n\n// override defaults for this template\nstencil({\n\tid:    id,\n\tstart: '`',\n\tstop:  '`',\n\techo:  'print',\n\tsafe:  'encode',\n\tasync: '@'\n}, data, function(err, result) {\n\t// here's my result\n});\n\n// or for all templates\nstencil.defaults.start = '`';\nstencil.defaults.stop  = '`';\n...\n\n// template code:\nMy pet is `if (hungry) { `hungry` } else { `sleepy` }`.\nHis name is: `print pet.name`.\n`@my_async_function(function(result) { print(result); next(); });`\nthe end.\n```\n\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 Andy VanWagoner\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"stencil-js@0.8.3","dist":{"shasum":"78e6f856a3ff42cf7f4d58be02e4e21c640db558","tarball":"https://registry.npmjs.org/stencil-js/-/stencil-js-0.8.3.tgz","integrity":"sha512-DUy0PcAkIPJy59Ab+QMpiXjdNnPBJBlRk3iCV+4q6BFhmWTwgFfNO/qxKNX4gACRaRDJBdIvHF5i1AVxLUfcjQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCsCTNw6CS3AjxUFDJf/dmokS7tWP7qbOKIo58Ke7EgXQIhAKIbXqGkiDv0wMa6rlm7BZ6gLvUJ9YlLBzXhu/nSRPHL"}]},"_npmVersion":"1.1.61","_npmUser":{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"},"maintainers":[{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"}]},"0.8.4":{"name":"stencil-js","description":"Async JavaScript Templating","version":"0.8.4","author":{"name":"Andy VanWagoner","email":"thetalecrafter@gmail.com"},"keywords":["stencil","template","view","asynchronous"],"repository":{"type":"git","url":"git://github.com/thetalecrafter/stencil.git"},"main":"stencil","engines":{"node":"*"},"readme":"# stencil\n\nstencil is a templating engine designed by Andy VanWagoner\n([thetalecrafter](http://github.com/thetalecrafter))\nto enable templates to run in an environment with asynchronous I/O,\nsuch as [node](http://nodejs.org), as well as in the browser.\n\nIf [ejs](https://github.com/visionmedia/ejs) suites your needs,\nyou should probably use that as it is better tested and is likely\nmore robust. However, stencil includes a few things that ejs\ndoes't yet.\n\n## Features\n\n  * Async tag to ensure template is processed sequentially\n  * Use the same template code both server and client side\n  * Generate function as a string on server for use on the client\n  * Choose to include \"use strict\"; or with(data) {...}\n  * Line numbers in generated code match original template\n\n\n## Usage - template code\n\nTemplates are specified using php/asp syntax, with code inside special tags.\nThere are also suffixes to the opening tag for print and async blocks.\nBy default the tags are php-style:\n\n```php\n<? javascript code here ?>\n<?= 'Today is ' + (new Date()) /* result is html encoded and included in output */ ?>\n<?= 'hello', ' ', 'world' /* multiple results can be output */ ?>\n<?- '<em>Important</em>' /* This output won't be encoded */ ?>\n\n<?! setTimeout(next, 1000); /* functionally equivalent to php sleep(1) */ !?>\n<?! someAsyncFunction(param1, function whendone(result) {\n\t\t// do stuff with result\n\t\tprint(result);\n\t\tnext(); // continue processing the rest of the template\n\t}); !?>\n```\n\nMembers of the data object are optionally put in the scope of the template code:\n\n```html\n<script type=\"text/template\" id=\"template\"><\n\tWhy I don't teach English anymore:\n\t<?= message ?>.\n</script>\n<script>\n\tstencil({\n\t\tid: 'template',\n\t\tsrc: document.getElementById('sub').innerHTML,\n\t\tstrict: false /* tells stencil to include a with(data) statement */\n\t}, { message:'The book is not on the table' },\n\t\tfunction(err, result) {\n\t\t\tif (err) return console.log('The template failed to run.');\n\t\t\tconsole.log('The template result was:' + result);\n\t\t}\n\t);\n</script>\n```\n\nWhile nested templates are not built into the language it is easy to do so\nwith a small amount of custom code:\n\n```javascript\n// client (no async done in sub)\n\t<?- stencil(document.getElementById('sub').innerHTML, $) ?>\n// server (sub can have async blocks)\n\t<?! fs.readFile('sub', 'utf8', function(err, tpl) {\n\t\tif (err) return next(err);\n\t\tstencil(tpl, $, next);\n\t}); !?>\n```\n\n\nImportant note:\n\nMake careful to put async blocks end tags at the same nesting level as the start.\nAll of the code inside will be wrapped into a function, and will be executed\nafter the main block completes.\n\n```php\n<?! if (works) { ?>a-okay<? } next(); !?>\n<?! if (!works) { !?>broken<? } next(); ?>\n```\n\nLooks something like this after it is compiled:\n\n```javascript\nasync(function(){ if (works) { print('a-okay'); } next(); });\nasync(function(){ if (!works) { }); print('broken'); } next();\n```\n\n```php\n<? alert('1'); print('1'); ?>\n<?! alert('3'); print('2'); next(); !?>\n<?! alert('4'); print('3'); next(); !?>\n<? alert('2'); print('4'); ?>\n// alerts 1 then 2 then 3 then 4\n// prints 1234\n```\n\n\n## Usage\n\n`stencil(options, data, onprint, oncomplete)` returns output if no async blocks were used\n\n`options` can be a template string or an object with these properties:\n* `id` - usually the filename or uri, used for caching the resulting function for subsequent runs\n* `src` - the template string\n* `start` - default '<?', start tag in the template\n* `stop` - default '?>', stop tag in the template\n* `echo` - default '-', suffix for echoing result of the expression\n* `safe` - default '=', suffix for echoing result of the expression html encoded\n* `async` - default '!', suffix for async blocks, Output is still in document order\n* `strict` - default true, start function with `\"use strict\";` or wrap function in `with(dataVar) {}`\n* `dataVar` - default '$', name of object parameter containing data mambers to use in execution\n* `chunkVar` - default '\\u03B9', name of function parameter called when each chunk is ready\n* `doneVar` - default '\\u03DD', name of function parameter called when output is complete\n* `outputVar` - default '\\u03A3', name of string used to hold the output\n* `safeVar` - default 'escape', name of function used to encode html characters\n* `echoVar` - default 'print', name of function used to output strings\n* `asyncVar` - default '\\u03BB', name of function used internally on async blocks\n* `nextVar` - default 'next', name of function to call when done with async block\n\n`data` object containing values to use in template execution\n\n`onprint(chunk)` - optional - function called for each chunk of output as it becomes ready\n\n`oncomplete(err, output)` function called when template has completed\n\n\n`stencil(options)` or `stencil.compile(options, string)` returns compiled function\n\n`options` template string or options, see above\n\n`string` - optional - if true, return compiled function as a string instead\n\n\n## Usage - client side\n\n```html\n<script src=\"stencil.js\"></script>\n<script type=\"text/template\" id=\"dom_id\">\n\t... template code here ...\n</script>\n<script>\n\tstencil(document.getElementById('dom_id').innerHTML,\n\t\t{ /*data*/ }, function(err, result) {\n\t\t/* all done */ \n\t\tif (err) { /* you broke it */ return; }\n\t\t/* use the result */\n\t});\n</script>\n```\n\n\n## Usage - server side\n\n```javascript\nvar stencil = require('./stencil');\n\nstencil('Hello <?- $.whom ?>!', { whom:'World' },\n\tfunction(data) { /* use the data chunks */ },\n\tfunction(err, result) { /* all done */ }\n);\n```\n\n\n## Usage - custom tags\n\n```javascript\n\n// override defaults for this template\nstencil({\n\tid:    id,\n\tstart: '`',\n\tstop:  '`',\n\techo:  'print',\n\tsafe:  'encode',\n\tasync: '@'\n}, data, function(err, result) {\n\t// here's my result\n});\n\n// or for all templates\nstencil.defaults.start = '`';\nstencil.defaults.stop  = '`';\n...\n\n// template code:\nMy pet is `if (hungry) { `hungry` } else { `sleepy` }`.\nHis name is: `print pet.name`.\n`@my_async_function(function(result) { print(result); next(); });`\nthe end.\n```\n\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 Andy VanWagoner\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"stencil-js@0.8.4","dist":{"shasum":"68c52e170ec4b54409e8dc71ea30c850a64ce7e8","tarball":"https://registry.npmjs.org/stencil-js/-/stencil-js-0.8.4.tgz","integrity":"sha512-valU3lIpjbvQ7rXYPop4u0xrSg6ZHG8ykdBFqVdMTUicMBunsETBKdbzZjPcw4IF2LGt4qYa8Us67a4M+LINHw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDv7SHAE0FuoDWmJR2mYvKwaERSk2pU3ddyDhkRtOQ1uAiEA0C6wzGEovb5xP160Wuyi3+QFc1LBpqLyZiD2DM5Ge5Q="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"},"maintainers":[{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"}]}},"readme":"# stencil\n\nstencil is a templating engine designed by Andy VanWagoner\n([thetalecrafter](http://github.com/thetalecrafter))\nto enable templates to run in an environment with asynchronous I/O,\nsuch as [node](http://nodejs.org), as well as in the browser.\n\nWhile there have been many other libraries with the same claims,\nall of the ones currently maintained use the mustache syntax,\nwhile this uses asp / erb / php style syntax.\n\n## Features\n\n  * Async nested templates\n  * Async tag to ensure template is processed sequentially\n  * Use the same template code both server and client side\n\n\n## Shared templates\n\nThe motivator for stencil was to share templates between server and client code.\nThe template can be used server side to generate a widget in the initial page load,\nand then the template can be included on the page to update the widget.\n\nThe code to generate and update a widget can be the same file.\n\n\n## Usage - template code\n\nTemplates are specified using php/asp syntax, with code inside special tags.\nBy default the tags are php-style:\n\n```php\n<? javascript code here ?>\n```\n\nThere are also suffixes to the opening tag for ouput, include, and async blocks.\n\n```php\n<?= 'Today is ' + (new Date()) // result is html encoded and included in output ?>\n<?= 'hello', ' ', 'world' // multiple results can be output ?>\n<?- '<em>Important</em>' // This output won't be encoded ?>\n\n<?# 'child-template-id' // result passed as id to include() ?>\n<?# { id:'child', async:'~' }, { custom:'data' } // override options and data variables in child template ?>\n\n<?! setTimeout(next, 1000); // functionally equivalent to php sleep(1) ?>\n<?! someAsyncFunction(param1, function whendone(result) {\n\t\t// do stuff with result\n\t\tprint(result);\n\t\tnext(); // continue processing the rest of the template\n\t}); ?>\n```\n\nMembers of the data object are put in the scope of the template code:\n\n```html\n<script type=\"text/template\" id=\"template\"><[CDATA[\n\tWhy I don't teach English anymore:\n\t<?= message ?>.\n]]></script>\n<script>\n\tstencil({ id:'template' }, { message:'The book is not on the table' },\n\t\tfunction(err, result) {\n\t\t\tif (err) return console.log('The template failed to run.');\n\t\t\tconsole.log('The template result was:' + result);\n\t\t}\n\t);\n</script>\n```\n\n\nImportant note:\n\nUnlike regular code tags, async tags cannot not include partial statements.\nAll of the code inside will be wrapped into a function.\nAll of the code following will also be wrapped into a function.\n\nThis would not work:\n\n```php\n<?! if (true) { ?>some output<? } ?>\n```\n\nSince compiled it would be similar to:\n\n```javascript\n(function(next){ if (true) { })(function() { print('some output'); } });\n```\n\n\n## Usage - client side\n\n```html\n<script src=\"stencil.js\"></script>\n<script type=\"text/template\" id=\"dom_id\">\n\t<[CDATA[\n\t... template code here ...\n\t]]>\n</script>\n<script>\n\tstencil.compile({ id:'dom_id' }, function(err, template) {\n\t\ttemplate(\n\t\t\t{ data:object },\n\t\t\tfunction(data) { /* optional - use the data chunks */ },\n\t\t\tfunction(err, result) { /* all done */ },\n\t\t);\n\t});\n\n\t// or\n\n\tstencil('dom_id', { data:object }, function(err, result) {\n\t\t/* all done */ \n\t\tif (err) { /* you broke it */ return; }\n\t\t/* use the result */\n\t});\n</script>\n```\n\n\n## Usage - server side\n\n```javascript\nvar stencil = require('./stencil');\n\nstencil('/path/to/template', { data:object },\n\tfunction(data) { /* use the data chunks */ },\n\tfunction(err, result) { /* all done */ }\n);\n\n// same variations apply as client side.\n```\n\n\n## Usage - custom tags\n\n```javascript\nstencil({\n\tid:    id,\n\tstart: '`',\n\tstop:  '`',\n\techo:  'print',\n\tsafe:  'encode',\n\tnest:  ' include this template:',\n\tasync: '@'\n}, data, function(err, result) {\n\t// here's my result\n});\n\n// template code:\nMy pet is `if (hungry) { `hungry` } else { `sleepy` }`.\nHis name is: `print pet.name`.\nHe looks like: ` include this template: 'looks_like', pet `.\n`@my_async_function(function(result) { print(result); next(); });`\nthe end.\n```\n\n\n## Usage - synchronous\n\nYou can fetch templates synchronously, if you need to. The caveat here\nis that you cannot do anything asynchronous in your template, or\nyou will only get the ouput up until the first asynchronous part. The setting\nreally only makes includes happen synchronously.\n\n```javascript\ntry { var result = stencil({ id:'id', sync_include:true }, data); }\ncatch (err) { /* You broke it. */ }\n```\n\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 Andy VanWagoner\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"thetalecrafter","email":"thetalecrafter@gmail.com"}],"time":{"modified":"2022-06-27T00:20:07.768Z","created":"2012-08-12T04:39:33.635Z","0.5.0":"2012-08-12T04:39:34.866Z","0.6.0":"2012-08-15T14:30:40.206Z","0.6.1":"2012-08-16T06:14:34.194Z","0.6.2":"2012-08-18T05:35:24.350Z","0.7.0":"2012-08-21T21:12:25.805Z","0.7.1":"2012-08-24T00:06:30.245Z","0.7.2":"2012-08-25T01:50:21.911Z","0.8.0":"2012-09-09T05:14:28.419Z","0.8.1":"2012-09-10T15:45:42.869Z","0.8.2":"2012-09-15T14:30:32.876Z","0.8.3":"2012-09-19T03:04:33.484Z","0.8.4":"2012-10-09T04:54:43.041Z"},"author":{"name":"Andy VanWagoner","email":"thetalecrafter@gmail.com"},"repository":{"type":"git","url":"git://github.com/thetalecrafter/stencil.git"}}