{"_id":"jinsoku","_rev":"27-197fced371ae3f364da90dd751c1b7f7","name":"jinsoku","description":"High performance Javascript template engine inspired by Jade's power and doT's speed.","dist-tags":{"latest":"0.2.4"},"versions":{"0.1.0":{"name":"jinsoku","description":"High performance Javascript template engine inspired by Jade's power and doT's speed.","version":"0.1.0","author":{"name":"Shogun","email":"Shogun147@gmail.com","url":"http://github.com/Shogun147"},"contributors":[{"name":"Shogun","email":"Shogun147@gmail.com"}],"keywords":["jinsoku","template","speed","jade","doT"],"repository":{"type":"git","url":"git://github.com/Shogun147/Jinsoku.git","web":"http://github.com/Shogun147/Jinsoku"},"bugs":{"url":"https://github.com/Shogun147/Jinsoku/issues"},"dependencies":{},"devDependencies":{},"main":"./jinsoku","engines":{"node":"> 0.4"},"readme":"# Jinsoku - template engine\n\nHigh performance Javascript template engine inspired by Jade's power and doT's speed.\n\n## Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Browser support](#browser-support)\n- [Public API](#public-api)\n    - [Settings](#options)\n- [Syntax](#syntax)\n    - [Template inheritance](#template-inheritance)\n    - [Template includes](#includes)\n    - [Block extending/clone/prepend/append](#blocks)\n    - [Array and Object iterators](#array-and-object-iterators)\n    - [Conditionals](#conditionals)\n- [Examples](#examples)\n- [Extending](#extending)\n- [License](#license)\n\n## Features\n\n- Fast & Furious\n- Client-side support\n- Template inheritance\n- Static includes\n- Asynchronous partials loading support\n- Blocks extending and cloning\n- Iterators and Conditionals\n- Extensible\n\n## Installation\n\nvia npm:\n\n    npm install jinsoku\n\n### Browser support\n\nJinsoku has no dependencies so you could just require it.\n\n## Public API\n\nBefore compile something we need to set `Jinsoku.template` function, this is used to get content for a template path. It also support async loading.\n\nEx. node.js:\n\n    var path    = process.cwd() + '/views/';\n    var Fs      = require('fs');\n    var Jinsoku = require('jinsoku');\n\n    // @template - template path, [include: this/is/path] or [extend: view/path]\n    // @callback - a callback which get template content as argument\n    Jinsoku.template = function(template, callback) {\n      Fs.readFile(path + template + '.html', 'utf-8', function(error, content) {\n        callback(content);\n      })\n    };\n\nEx. browser:\n\n    <script type=\"text/javascript\" src=\"/jinsoku.js\"></script>\n    <script type=\"text/javascript\">\n      Jinsoku.template = function(template, callback) {\n        // use jQuery ajax call\n        $.ajax({\n          url: '/views/'+template+'.html'\n        }).done(function(content) {\n          callback(content);\n        });\n      }\n    </script>\n\nThen we can compile templates:\n\n    // For sync templates loading compiled function is also returned\n    var fn = Jinsoku.compile('home'); // home.html template\n\n    fn(locals);\n\n    // but for async loading we must wait it from callback\n    Jinsoku.compile('home', function(fn) {\n      fn(locals);\n    });\n\n### Options\n\nBefore compile you could set some options in `Jinsoku.settings`:\n\n- `strip`: `true` - Strip whitespaces of the html output or not.\n- `dataname`: `data` - Locals variable object.\n- `extract`: `false` - Extract locals to local scope. When `true` locals are available directly, without `dataname` prefix, but compiled function will run slower.\n- `import_deps`: `true` - If dependencies should be included in compiled template or not.\n- `wrap`: `false` - Wrap function into a scope or not, if `false` then `this` is global scope.\n- `scope`: `{}` - The scope in which fn runs if `wrap=true`.\n\n## Template inheritance\n\nJinsoku supports template inheritance via `extend` keyword.\n\nSuppose we have the following template content.html:\n\n    <div id=\"content\">\n      <h2>Page title</h2>\n      <p>Page content</p>\n    </div>\n\nNow to extend this template in home.html:\n\n    [extend: content]\n      <div id=\"copyright\">&copy; 2012 MyCompany</div>\n    [/extend]\n\nand result will be:\n\n    <div id=\"content\">\n      <h2>Page title</h2>\n      <p>Page content</p>\n    </div>\n    <div id=\"copyright\">&copy; 2012 MyCompany</div>\n\nWe could extend more templates at the same time which will compile to one bigger.\n\nFor example home.html:\n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n      <head>\n        [extend: head]\n          <title>Jinsoku Template Engine</title>\n        [/extend]\n      </head>\n    <body>\n      [extend: top][/extend]\n  \n      [extend: content][/extend]\n  \n      [extend: footer][/extend]\n    </body>\n    </html>\n\n## Includes\n\nIncludes allow you to statically include parts of content.\n\nFor example home.html which has body in separate file:\n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n      <head>\n        [extend: head]\n          <title>Jinsoku Template Engine</title>\n        [/extend]\n      </head>\n    <body>\n      [include: body]\n    </body>\n    </html>\n\nand body.html:\n\n    [extend: top][/extend]\n  \n    [extend: content][/extend]\n  \n    [extend: footer][/extend]\n\n## Blocks\n\nEach template could be splitted in more parts named blocks.Then after we extend this template we may replace content of the blocks, prepend and append content, or even clone them.\n\nSuppose we have this head.html template:\n\n    <head>\n      [block: meta]\n        <meta charset=\"utf-8\">\n      [/block]\n      [block: scripts]\n        <script type=\"text/javascript\" src=\"/public/scripts/jquery.js\"></script>\n      [/block]\n    </head>\n\nnow in home.html to extend and add something to our head:\n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n    [extend: head]\n      [append: meta]\n        <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n      [/append]\n      [append: scripts]\n        <script type=\"text/javascript\" src=\"/public/scripts/app.js\"></script>\n      [/append]\n    [/extend]\n    <body>\n      Body content\n    </body>\n    </html>\n\nthis will add meta tag to meta block and app.js script to scripts block so final home.html will look like: \n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n    <head>\n      <meta charset=\"utf-8\">\n      <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n      <script type=\"text/javascript\" src=\"/public/scripts/jquery.js\"></script>\n      <script type=\"text/javascript\" src=\"/public/scripts/app.js\"></script>\n    </head>\n    <body>\n      Body content\n    </body>\n    </html>\n\nTo replace a block we need just to redefine it:\n\n    [extend: head]\n      [block: meta]\n        <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n      [/block]\n    [/extend]\n\nNow meta block will contain only meta keywords without the charset.\n\nThere also is the possibility to clone a block at the same time. To do this just add exclamation mark after block name and the block will be cloned in this place.\n\n    [append: menu!]\n      <li><a href=\"/about\">About</a></li>\n    [/append]\n\nThis will append new item to the menu and clone entire menu in this place.\n\nTo just clone a block use `clone`:\n\n    [clone: pagination]\n\n## Array and Object iterators\n\nJinsoku also supports friendly iterators over arrays(each) and objects(for).\n\nFor arrays:\n\n    [# var items = ['one', 'two', 'three', 'four']; #]\n\n    [each:items :item]\n      <li>#[item]</li>\n    [/each]\n    \n    //result\n    <li>one</li>\n    <li>two</li>\n    <li>three</li>\n    <li>four</li>\n\n    //with index:\n    [each:items :item:i]\n      <li>#[i+1]. #[item]</li>\n    [/each]\n\n    //result\n    <li>1. one</li>\n    <li>2. two</li>\n    <li>3. three</li>\n    <li>4. four</li>\n\nFor objects:\n\n    [# var obj = { foo: 'bar' }; #]\n\n    [for:obj :value:key]\n      <li>#[key]: #[value]</li>\n    [/for]\n\n    //result\n    <li>foo: bar</li>\n\n## Conditionals\n\nJinsoku has shortcut support for `if` and `switch` statements.\n\n    [if: User.logged_in]              // if (User.logged_in) {\n      Welcome back, #[User.username]!\n    [: User.banned]                   // else if (User.banned) {\n      Access denied, you are banned!\n    [:]                               // else {\n      Hello guest, please login!\n    [/if]                             // }\n\n    [case: User.role]                      // switch(User.role) {\n      [:'administrator']                   // case 'administrator':\n        #[User.username] is administrator.\n      [:'moderator']                       // break; case 'moderator':\n        #[User.username] is moderator.\n      [:]                                  // break; default:\n        #[User.username] is user.\n    [/case]                                // break; }\n\n\n## Examples\n\nOne more complex example:\n\n## Extending\n\nYou can easily extend jinsoku by adding new or replace one of the  existing parsers(if, case, each, for, var, evaluate).\n\nTo register a parser:\n\n    @name - parser name, if the parser with same name already exists then he will be replaced by this one\n    @regexp - regular expression for parser\n    @callback - callback for regexp matching, it gets template name and view object as first 2 arguments and then arguments of the regexp match\n    Jinsoku.parser(name, regexp, callback);\n\nThe returned value from callback is used as replacer for regexp match.\n    \n## License\n\nThe MIT License\n\nCopyright © 2012 D.G. Shogun Shogun147@gmail.com\n\n\n\n\n\n\n\n\n\n","_id":"jinsoku@0.1.0","dist":{"shasum":"edd1c29675b74d506e42d6d0157d9a12bf454a2c","tarball":"https://registry.npmjs.org/jinsoku/-/jinsoku-0.1.0.tgz","integrity":"sha512-ZKrFHvIwvZITSlYrafOorS5Tf47UkNssd3l06koj0IXHOhmUcOxDvTonHWknqkJEeNOoOPRoPH/fXzXeMnK26w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDHVRziUT278t1rQyuTMBnc6l8wbIYD6QYEiCsEcpninAIgVFMWlTQYCEsEbGXW9j0llCPg03nIyG9DmHdVU3KsXKY="}]},"_npmVersion":"1.1.49","_npmUser":{"name":"shogun","email":"Shogun147@gmail.com"},"maintainers":[{"name":"shogun","email":"Shogun147@gmail.com"}],"directories":{}},"0.2.0":{"name":"jinsoku","description":"High performance Javascript template engine inspired by Jade's power and doT's speed.","version":"0.2.0","author":{"name":"Shogun","email":"Shogun147@gmail.com","url":"http://github.com/Shogun147"},"keywords":["jinsoku","template","speed","jade","doT","view"],"repository":{"type":"git","url":"git://github.com/Shogun147/Jinsoku.git","web":"http://github.com/Shogun147/Jinsoku"},"bugs":{"url":"https://github.com/Shogun147/Jinsoku/issues"},"dependencies":{"cheerio":"*","async":"*"},"devDependencies":{},"main":"./jinsoku","engines":{"node":"> 0.6"},"readme":"# Jinsoku - template engine\n\nHigh performance Javascript template engine inspired by Jade's power and doT's speed.\n\n## WARNING: This is outdated, old code. I've started new version from the ground, fully rewrite. Comming soon.\n\n## Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Browser support](#browser-support)\n- [Public API](#public-api)\n    - [Settings](#options)\n- [Syntax](#syntax)\n    - [Template inheritance](#template-inheritance)\n    - [Template includes](#includes)\n    - [Block extending/clone/prepend/append](#blocks)\n    - [Array and Object iterators](#array-and-object-iterators)\n    - [Conditionals](#conditionals)\n- [Examples](#examples)\n- [Extending](#extending)\n- [License](#license)\n\n## Features\n\n- Fast & Furious\n- Client-side support\n- Template inheritance\n- Static includes\n- Asynchronous partials loading support\n- Blocks extending and cloning\n- Iterators and Conditionals\n- Extensible\n\n## Installation\n\nvia npm:\n\n    npm install jinsoku\n\n### Browser support\n\nJinsoku has no dependencies so you could just require it.\n\n## Public API\n\nBefore compile something we need to set `Jinsoku.template` function, this is used to get content for a template path. It also support async loading.\n\nEx. node.js:\n\n    var path    = process.cwd() + '/views/';\n    var Fs      = require('fs');\n    var Jinsoku = require('jinsoku');\n\n    // @template - template path, [include: this/is/path] or [extend: view/path]\n    // @callback - a callback which get template content as argument\n    Jinsoku.template = function(template, callback) {\n      Fs.readFile(path + template + '.html', 'utf-8', function(error, content) {\n        callback(content);\n      })\n    };\n\nEx. browser:\n\n    <script type=\"text/javascript\" src=\"/jinsoku.js\"></script>\n    <script type=\"text/javascript\">\n      Jinsoku.template = function(template, callback) {\n        // use jQuery ajax call\n        $.ajax({\n          url: '/views/'+template+'.html'\n        }).done(function(content) {\n          callback(content);\n        });\n      }\n    </script>\n\nThen we can compile templates:\n\n    // For sync templates loading compiled function is also returned\n    var fn = Jinsoku.compile('home'); // home.html template\n\n    fn(locals);\n\n    // but for async loading we must wait it from callback\n    Jinsoku.compile('home', function(fn) {\n      fn(locals);\n    });\n\n### Options\n\nBefore compile you could set some options in `Jinsoku.settings`:\n\n- `strip`: `true` - Strip whitespaces of the html output or not.\n- `dataname`: `data` - Locals variable object.\n- `extract`: `false` - Extract locals to local scope. When `true` locals are available directly, without `dataname` prefix, but compiled function will run slower.\n- `import_deps`: `true` - If dependencies should be included in compiled template or not.\n- `wrap`: `false` - Wrap function into a scope or not, if `false` then `this` is global scope.\n- `scope`: `{}` - The scope in which fn runs if `wrap=true`.\n\n## Template inheritance\n\nJinsoku supports template inheritance via `extend` keyword.\n\nSuppose we have the following template content.html:\n\n    <div id=\"content\">\n      <h2>Page title</h2>\n      <p>Page content</p>\n    </div>\n\nNow to extend this template in home.html:\n\n    [extend: content]\n      <div id=\"copyright\">&copy; 2012 MyCompany</div>\n    [/extend]\n\nand result will be:\n\n    <div id=\"content\">\n      <h2>Page title</h2>\n      <p>Page content</p>\n    </div>\n    <div id=\"copyright\">&copy; 2012 MyCompany</div>\n\nWe could extend more templates at the same time which will compile to one bigger.\n\nFor example home.html:\n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n      <head>\n        [extend: head]\n          <title>Jinsoku Template Engine</title>\n        [/extend]\n      </head>\n    <body>\n      [extend: top][/extend]\n  \n      [extend: content][/extend]\n  \n      [extend: footer][/extend]\n    </body>\n    </html>\n\n## Includes\n\nIncludes allow you to statically include parts of content.\n\nFor example home.html which has body in separate file:\n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n      <head>\n        [extend: head]\n          <title>Jinsoku Template Engine</title>\n        [/extend]\n      </head>\n    <body>\n      [include: body]\n    </body>\n    </html>\n\nand body.html:\n\n    [extend: top][/extend]\n  \n    [extend: content][/extend]\n  \n    [extend: footer][/extend]\n\n## Blocks\n\nEach template could be splitted in more parts named blocks.Then after we extend this template we may replace content of the blocks, prepend and append content, or even clone them.\n\nSuppose we have this head.html template:\n\n    <head>\n      [block: meta]\n        <meta charset=\"utf-8\">\n      [/block]\n      [block: scripts]\n        <script type=\"text/javascript\" src=\"/public/scripts/jquery.js\"></script>\n      [/block]\n    </head>\n\nnow in home.html to extend and add something to our head:\n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n    [extend: head]\n      [append: meta]\n        <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n      [/append]\n      [append: scripts]\n        <script type=\"text/javascript\" src=\"/public/scripts/app.js\"></script>\n      [/append]\n    [/extend]\n    <body>\n      Body content\n    </body>\n    </html>\n\nthis will add meta tag to meta block and app.js script to scripts block so final home.html will look like: \n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n    <head>\n      <meta charset=\"utf-8\">\n      <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n      <script type=\"text/javascript\" src=\"/public/scripts/jquery.js\"></script>\n      <script type=\"text/javascript\" src=\"/public/scripts/app.js\"></script>\n    </head>\n    <body>\n      Body content\n    </body>\n    </html>\n\nTo replace a block we need just to redefine it:\n\n    [extend: head]\n      [block: meta]\n        <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n      [/block]\n    [/extend]\n\nNow meta block will contain only meta keywords without the charset.\n\nThere also is the possibility to clone a block at the same time. To do this just add exclamation mark after block name and the block will be cloned in this place.\n\n    [append: menu!]\n      <li><a href=\"/about\">About</a></li>\n    [/append]\n\nThis will append new item to the menu and clone entire menu in this place.\n\nTo just clone a block use `clone`:\n\n    [clone: pagination]\n\n## Array and Object iterators\n\nJinsoku also supports friendly iterators over arrays(each) and objects(for).\n\nFor arrays:\n\n    [# var items = ['one', 'two', 'three', 'four']; #]\n\n    [each:items :item]\n      <li>#[item]</li>\n    [/each]\n    \n    //result\n    <li>one</li>\n    <li>two</li>\n    <li>three</li>\n    <li>four</li>\n\n    //with index:\n    [each:items :item:i]\n      <li>#[i+1]. #[item]</li>\n    [/each]\n\n    //result\n    <li>1. one</li>\n    <li>2. two</li>\n    <li>3. three</li>\n    <li>4. four</li>\n\nFor objects:\n\n    [# var obj = { foo: 'bar' }; #]\n\n    [for:obj :value:key]\n      <li>#[key]: #[value]</li>\n    [/for]\n\n    //result\n    <li>foo: bar</li>\n\n## Conditionals\n\nJinsoku has shortcut support for `if` and `switch` statements.\n\n    [if: User.logged_in]              // if (User.logged_in) {\n      Welcome back, #[User.username]!\n    [: User.banned]                   // else if (User.banned) {\n      Access denied, you are banned!\n    [:]                               // else {\n      Hello guest, please login!\n    [/if]                             // }\n\n    [case: User.role]                      // switch(User.role) {\n      [:'administrator']                   // case 'administrator':\n        #[User.username] is administrator.\n      [:'moderator']                       // break; case 'moderator':\n        #[User.username] is moderator.\n      [:]                                  // break; default:\n        #[User.username] is user.\n    [/case]                                // break; }\n\n\n## Examples\n\nOne more complex example:\n\n## Extending\n\nYou can easily extend jinsoku by adding new or replace one of the  existing parsers(if, case, each, for, var, evaluate).\n\nTo register a parser:\n\n    @name - parser name, if the parser with same name already exists then he will be replaced by this one\n    @regexp - regular expression for parser\n    @callback - callback for regexp matching, it gets template name and view object as first 2 arguments and then arguments of the regexp match\n    Jinsoku.parser(name, regexp, callback);\n\nThe returned value from callback is used as replacer for regexp match.\n    \n## License\n\nThe MIT License\n\nCopyright © 2012 D.G. Shogun Shogun147@gmail.com\n\n\n\n\n\n\n\n\n\n","readmeFilename":"readme.md","_id":"jinsoku@0.2.0","dist":{"shasum":"c76d04da4e6ab45c6cbcba4e5a4088b56014a642","tarball":"https://registry.npmjs.org/jinsoku/-/jinsoku-0.2.0.tgz","integrity":"sha512-jTJYW+0a79aNn6vhODNHkGM6lfoH4vcxDUnzQrUh/vzq8OprydLmCoj6YZ2QaBdoBN/5zYw50R0rWEWCNYLvqQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF3K6nu3gb5ezAxPiF9a0bNJ5zFYuzelmE4aBictvL/1AiEAqVHk5vaL38AVw56jgyFON7zzrMhYTD/dudTFv106T1A="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"shogun","email":"Shogun147@gmail.com"},"maintainers":[{"name":"shogun","email":"Shogun147@gmail.com"}],"directories":{}},"0.2.1":{"name":"jinsoku","description":"High performance Javascript template engine inspired by Jade's power and doT's speed.","version":"0.2.1","author":{"name":"Shogun","email":"Shogun147@gmail.com","url":"http://github.com/Shogun147"},"keywords":["jinsoku","template","speed","jade","doT","view"],"repository":{"type":"git","url":"git://github.com/Shogun147/Jinsoku.git","web":"http://github.com/Shogun147/Jinsoku"},"bugs":{"url":"https://github.com/Shogun147/Jinsoku/issues"},"dependencies":{"cheerio":"*","async":"*"},"devDependencies":{},"main":"./jinsoku","engines":{"node":"> 0.6"},"readme":"# Jinsoku - template engine\n\nHigh performance Javascript template engine inspired by Jade's power and doT's speed.\n\n## WARNING: This is outdated, old code. I've started new version from the ground, fully rewrite. Comming soon.\n\n## Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Browser support](#browser-support)\n- [Public API](#public-api)\n    - [Settings](#options)\n- [Syntax](#syntax)\n    - [Template inheritance](#template-inheritance)\n    - [Template includes](#includes)\n    - [Block extending/clone/prepend/append](#blocks)\n    - [Array and Object iterators](#array-and-object-iterators)\n    - [Conditionals](#conditionals)\n- [Examples](#examples)\n- [Extending](#extending)\n- [License](#license)\n\n## Features\n\n- Fast & Furious\n- Client-side support\n- Template inheritance\n- Static includes\n- Asynchronous partials loading support\n- Blocks extending and cloning\n- Iterators and Conditionals\n- Extensible\n\n## Installation\n\nvia npm:\n\n    npm install jinsoku\n\n### Browser support\n\nJinsoku has no dependencies so you could just require it.\n\n## Public API\n\nBefore compile something we need to set `Jinsoku.template` function, this is used to get content for a template path. It also support async loading.\n\nEx. node.js:\n\n    var path    = process.cwd() + '/views/';\n    var Fs      = require('fs');\n    var Jinsoku = require('jinsoku');\n\n    // @template - template path, [include: this/is/path] or [extend: view/path]\n    // @callback - a callback which get template content as argument\n    Jinsoku.template = function(template, callback) {\n      Fs.readFile(path + template + '.html', 'utf-8', function(error, content) {\n        callback(content);\n      })\n    };\n\nEx. browser:\n\n    <script type=\"text/javascript\" src=\"/jinsoku.js\"></script>\n    <script type=\"text/javascript\">\n      Jinsoku.template = function(template, callback) {\n        // use jQuery ajax call\n        $.ajax({\n          url: '/views/'+template+'.html'\n        }).done(function(content) {\n          callback(content);\n        });\n      }\n    </script>\n\nThen we can compile templates:\n\n    // For sync templates loading compiled function is also returned\n    var fn = Jinsoku.compile('home'); // home.html template\n\n    fn(locals);\n\n    // but for async loading we must wait it from callback\n    Jinsoku.compile('home', function(fn) {\n      fn(locals);\n    });\n\n### Options\n\nBefore compile you could set some options in `Jinsoku.settings`:\n\n- `strip`: `true` - Strip whitespaces of the html output or not.\n- `dataname`: `data` - Locals variable object.\n- `extract`: `false` - Extract locals to local scope. When `true` locals are available directly, without `dataname` prefix, but compiled function will run slower.\n- `import_deps`: `true` - If dependencies should be included in compiled template or not.\n- `wrap`: `false` - Wrap function into a scope or not, if `false` then `this` is global scope.\n- `scope`: `{}` - The scope in which fn runs if `wrap=true`.\n\n## Template inheritance\n\nJinsoku supports template inheritance via `extend` keyword.\n\nSuppose we have the following template content.html:\n\n    <div id=\"content\">\n      <h2>Page title</h2>\n      <p>Page content</p>\n    </div>\n\nNow to extend this template in home.html:\n\n    [extend: content]\n      <div id=\"copyright\">&copy; 2012 MyCompany</div>\n    [/extend]\n\nand result will be:\n\n    <div id=\"content\">\n      <h2>Page title</h2>\n      <p>Page content</p>\n    </div>\n    <div id=\"copyright\">&copy; 2012 MyCompany</div>\n\nWe could extend more templates at the same time which will compile to one bigger.\n\nFor example home.html:\n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n      <head>\n        [extend: head]\n          <title>Jinsoku Template Engine</title>\n        [/extend]\n      </head>\n    <body>\n      [extend: top][/extend]\n  \n      [extend: content][/extend]\n  \n      [extend: footer][/extend]\n    </body>\n    </html>\n\n## Includes\n\nIncludes allow you to statically include parts of content.\n\nFor example home.html which has body in separate file:\n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n      <head>\n        [extend: head]\n          <title>Jinsoku Template Engine</title>\n        [/extend]\n      </head>\n    <body>\n      [include: body]\n    </body>\n    </html>\n\nand body.html:\n\n    [extend: top][/extend]\n  \n    [extend: content][/extend]\n  \n    [extend: footer][/extend]\n\n## Blocks\n\nEach template could be splitted in more parts named blocks.Then after we extend this template we may replace content of the blocks, prepend and append content, or even clone them.\n\nSuppose we have this head.html template:\n\n    <head>\n      [block: meta]\n        <meta charset=\"utf-8\">\n      [/block]\n      [block: scripts]\n        <script type=\"text/javascript\" src=\"/public/scripts/jquery.js\"></script>\n      [/block]\n    </head>\n\nnow in home.html to extend and add something to our head:\n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n    [extend: head]\n      [append: meta]\n        <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n      [/append]\n      [append: scripts]\n        <script type=\"text/javascript\" src=\"/public/scripts/app.js\"></script>\n      [/append]\n    [/extend]\n    <body>\n      Body content\n    </body>\n    </html>\n\nthis will add meta tag to meta block and app.js script to scripts block so final home.html will look like: \n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n    <head>\n      <meta charset=\"utf-8\">\n      <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n      <script type=\"text/javascript\" src=\"/public/scripts/jquery.js\"></script>\n      <script type=\"text/javascript\" src=\"/public/scripts/app.js\"></script>\n    </head>\n    <body>\n      Body content\n    </body>\n    </html>\n\nTo replace a block we need just to redefine it:\n\n    [extend: head]\n      [block: meta]\n        <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n      [/block]\n    [/extend]\n\nNow meta block will contain only meta keywords without the charset.\n\nThere also is the possibility to clone a block at the same time. To do this just add exclamation mark after block name and the block will be cloned in this place.\n\n    [append: menu!]\n      <li><a href=\"/about\">About</a></li>\n    [/append]\n\nThis will append new item to the menu and clone entire menu in this place.\n\nTo just clone a block use `clone`:\n\n    [clone: pagination]\n\n## Array and Object iterators\n\nJinsoku also supports friendly iterators over arrays(each) and objects(for).\n\nFor arrays:\n\n    [# var items = ['one', 'two', 'three', 'four']; #]\n\n    [each:items :item]\n      <li>#[item]</li>\n    [/each]\n    \n    //result\n    <li>one</li>\n    <li>two</li>\n    <li>three</li>\n    <li>four</li>\n\n    //with index:\n    [each:items :item:i]\n      <li>#[i+1]. #[item]</li>\n    [/each]\n\n    //result\n    <li>1. one</li>\n    <li>2. two</li>\n    <li>3. three</li>\n    <li>4. four</li>\n\nFor objects:\n\n    [# var obj = { foo: 'bar' }; #]\n\n    [for:obj :value:key]\n      <li>#[key]: #[value]</li>\n    [/for]\n\n    //result\n    <li>foo: bar</li>\n\n## Conditionals\n\nJinsoku has shortcut support for `if` and `switch` statements.\n\n    [if: User.logged_in]              // if (User.logged_in) {\n      Welcome back, #[User.username]!\n    [: User.banned]                   // else if (User.banned) {\n      Access denied, you are banned!\n    [:]                               // else {\n      Hello guest, please login!\n    [/if]                             // }\n\n    [case: User.role]                      // switch(User.role) {\n      [:'administrator']                   // case 'administrator':\n        #[User.username] is administrator.\n      [:'moderator']                       // break; case 'moderator':\n        #[User.username] is moderator.\n      [:]                                  // break; default:\n        #[User.username] is user.\n    [/case]                                // break; }\n\n\n## Examples\n\nOne more complex example:\n\n## Extending\n\nYou can easily extend jinsoku by adding new or replace one of the  existing parsers(if, case, each, for, var, evaluate).\n\nTo register a parser:\n\n    @name - parser name, if the parser with same name already exists then he will be replaced by this one\n    @regexp - regular expression for parser\n    @callback - callback for regexp matching, it gets template name and view object as first 2 arguments and then arguments of the regexp match\n    Jinsoku.parser(name, regexp, callback);\n\nThe returned value from callback is used as replacer for regexp match.\n    \n## License\n\nThe MIT License\n\nCopyright © 2012 D.G. Shogun Shogun147@gmail.com\n\n\n\n\n\n\n\n\n\n","readmeFilename":"readme.md","_id":"jinsoku@0.2.1","dist":{"shasum":"49a65ba4dff431c53735a5b4e67b9dd887ee87b5","tarball":"https://registry.npmjs.org/jinsoku/-/jinsoku-0.2.1.tgz","integrity":"sha512-MVuVOpsSjgJL7zFbyG2xNLmSt4b7lSpSjai9gq2Iv5wMiaA+GH6TEgFVm6rEEWJCPK8ZLh7Qd71EZ2/u0Kwixg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAg4ubCa+ANKNgDLDqDk6YU9mbQvnuF63NC8FYJqcOyXAiEAshyTMQalet1mcvnBpk9BWHKtN8McjOq2z/acoObqYJs="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"shogun","email":"Shogun147@gmail.com"},"maintainers":[{"name":"shogun","email":"Shogun147@gmail.com"}],"directories":{}},"0.2.2":{"name":"jinsoku","description":"High performance Javascript template engine inspired by Jade's power and doT's speed.","version":"0.2.2","author":{"name":"Shogun","email":"Shogun147@gmail.com","url":"http://github.com/Shogun147"},"keywords":["jinsoku","template","speed","jade","doT","view"],"repository":{"type":"git","url":"git://github.com/Shogun147/Jinsoku.git","web":"http://github.com/Shogun147/Jinsoku"},"bugs":{"url":"https://github.com/Shogun147/Jinsoku/issues"},"dependencies":{"cheerio":"*","async":"*"},"devDependencies":{},"main":"./jinsoku","engines":{"node":"> 0.6"},"readme":"# Jinsoku - template engine\n\nHigh performance Javascript template engine inspired by Jade's power and doT's speed.\n\n## WARNING: This is outdated, old code. I've started new version from the ground, fully rewrite. Comming soon.\n\n## Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Browser support](#browser-support)\n- [Public API](#public-api)\n    - [Settings](#options)\n- [Syntax](#syntax)\n    - [Template inheritance](#template-inheritance)\n    - [Template includes](#includes)\n    - [Block extending/clone/prepend/append](#blocks)\n    - [Array and Object iterators](#array-and-object-iterators)\n    - [Conditionals](#conditionals)\n- [Examples](#examples)\n- [Extending](#extending)\n- [License](#license)\n\n## Features\n\n- Fast & Furious\n- Client-side support\n- Template inheritance\n- Static includes\n- Asynchronous partials loading support\n- Blocks extending and cloning\n- Iterators and Conditionals\n- Extensible\n\n## Installation\n\nvia npm:\n\n    npm install jinsoku\n\n### Browser support\n\nJinsoku has no dependencies so you could just require it.\n\n## Public API\n\nBefore compile something we need to set `Jinsoku.template` function, this is used to get content for a template path. It also support async loading.\n\nEx. node.js:\n\n    var path    = process.cwd() + '/views/';\n    var Fs      = require('fs');\n    var Jinsoku = require('jinsoku');\n\n    // @template - template path, [include: this/is/path] or [extend: view/path]\n    // @callback - a callback which get template content as argument\n    Jinsoku.template = function(template, callback) {\n      Fs.readFile(path + template + '.html', 'utf-8', function(error, content) {\n        callback(content);\n      })\n    };\n\nEx. browser:\n\n    <script type=\"text/javascript\" src=\"/jinsoku.js\"></script>\n    <script type=\"text/javascript\">\n      Jinsoku.template = function(template, callback) {\n        // use jQuery ajax call\n        $.ajax({\n          url: '/views/'+template+'.html'\n        }).done(function(content) {\n          callback(content);\n        });\n      }\n    </script>\n\nThen we can compile templates:\n\n    // For sync templates loading compiled function is also returned\n    var fn = Jinsoku.compile('home'); // home.html template\n\n    fn(locals);\n\n    // but for async loading we must wait it from callback\n    Jinsoku.compile('home', function(fn) {\n      fn(locals);\n    });\n\n### Options\n\nBefore compile you could set some options in `Jinsoku.settings`:\n\n- `strip`: `true` - Strip whitespaces of the html output or not.\n- `dataname`: `data` - Locals variable object.\n- `extract`: `false` - Extract locals to local scope. When `true` locals are available directly, without `dataname` prefix, but compiled function will run slower.\n- `import_deps`: `true` - If dependencies should be included in compiled template or not.\n- `wrap`: `false` - Wrap function into a scope or not, if `false` then `this` is global scope.\n- `scope`: `{}` - The scope in which fn runs if `wrap=true`.\n\n## Template inheritance\n\nJinsoku supports template inheritance via `extend` keyword.\n\nSuppose we have the following template content.html:\n\n    <div id=\"content\">\n      <h2>Page title</h2>\n      <p>Page content</p>\n    </div>\n\nNow to extend this template in home.html:\n\n    [extend: content]\n      <div id=\"copyright\">&copy; 2012 MyCompany</div>\n    [/extend]\n\nand result will be:\n\n    <div id=\"content\">\n      <h2>Page title</h2>\n      <p>Page content</p>\n    </div>\n    <div id=\"copyright\">&copy; 2012 MyCompany</div>\n\nWe could extend more templates at the same time which will compile to one bigger.\n\nFor example home.html:\n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n      <head>\n        [extend: head]\n          <title>Jinsoku Template Engine</title>\n        [/extend]\n      </head>\n    <body>\n      [extend: top][/extend]\n  \n      [extend: content][/extend]\n  \n      [extend: footer][/extend]\n    </body>\n    </html>\n\n## Includes\n\nIncludes allow you to statically include parts of content.\n\nFor example home.html which has body in separate file:\n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n      <head>\n        [extend: head]\n          <title>Jinsoku Template Engine</title>\n        [/extend]\n      </head>\n    <body>\n      [include: body]\n    </body>\n    </html>\n\nand body.html:\n\n    [extend: top][/extend]\n  \n    [extend: content][/extend]\n  \n    [extend: footer][/extend]\n\n## Blocks\n\nEach template could be splitted in more parts named blocks.Then after we extend this template we may replace content of the blocks, prepend and append content, or even clone them.\n\nSuppose we have this head.html template:\n\n    <head>\n      [block: meta]\n        <meta charset=\"utf-8\">\n      [/block]\n      [block: scripts]\n        <script type=\"text/javascript\" src=\"/public/scripts/jquery.js\"></script>\n      [/block]\n    </head>\n\nnow in home.html to extend and add something to our head:\n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n    [extend: head]\n      [append: meta]\n        <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n      [/append]\n      [append: scripts]\n        <script type=\"text/javascript\" src=\"/public/scripts/app.js\"></script>\n      [/append]\n    [/extend]\n    <body>\n      Body content\n    </body>\n    </html>\n\nthis will add meta tag to meta block and app.js script to scripts block so final home.html will look like: \n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n    <head>\n      <meta charset=\"utf-8\">\n      <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n      <script type=\"text/javascript\" src=\"/public/scripts/jquery.js\"></script>\n      <script type=\"text/javascript\" src=\"/public/scripts/app.js\"></script>\n    </head>\n    <body>\n      Body content\n    </body>\n    </html>\n\nTo replace a block we need just to redefine it:\n\n    [extend: head]\n      [block: meta]\n        <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n      [/block]\n    [/extend]\n\nNow meta block will contain only meta keywords without the charset.\n\nThere also is the possibility to clone a block at the same time. To do this just add exclamation mark after block name and the block will be cloned in this place.\n\n    [append: menu!]\n      <li><a href=\"/about\">About</a></li>\n    [/append]\n\nThis will append new item to the menu and clone entire menu in this place.\n\nTo just clone a block use `clone`:\n\n    [clone: pagination]\n\n## Array and Object iterators\n\nJinsoku also supports friendly iterators over arrays(each) and objects(for).\n\nFor arrays:\n\n    [# var items = ['one', 'two', 'three', 'four']; #]\n\n    [each:items :item]\n      <li>#[item]</li>\n    [/each]\n    \n    //result\n    <li>one</li>\n    <li>two</li>\n    <li>three</li>\n    <li>four</li>\n\n    //with index:\n    [each:items :item:i]\n      <li>#[i+1]. #[item]</li>\n    [/each]\n\n    //result\n    <li>1. one</li>\n    <li>2. two</li>\n    <li>3. three</li>\n    <li>4. four</li>\n\nFor objects:\n\n    [# var obj = { foo: 'bar' }; #]\n\n    [for:obj :value:key]\n      <li>#[key]: #[value]</li>\n    [/for]\n\n    //result\n    <li>foo: bar</li>\n\n## Conditionals\n\nJinsoku has shortcut support for `if` and `switch` statements.\n\n    [if: User.logged_in]              // if (User.logged_in) {\n      Welcome back, #[User.username]!\n    [: User.banned]                   // else if (User.banned) {\n      Access denied, you are banned!\n    [:]                               // else {\n      Hello guest, please login!\n    [/if]                             // }\n\n    [case: User.role]                      // switch(User.role) {\n      [:'administrator']                   // case 'administrator':\n        #[User.username] is administrator.\n      [:'moderator']                       // break; case 'moderator':\n        #[User.username] is moderator.\n      [:]                                  // break; default:\n        #[User.username] is user.\n    [/case]                                // break; }\n\n\n## Examples\n\nOne more complex example:\n\n## Extending\n\nYou can easily extend jinsoku by adding new or replace one of the  existing parsers(if, case, each, for, var, evaluate).\n\nTo register a parser:\n\n    @name - parser name, if the parser with same name already exists then he will be replaced by this one\n    @regexp - regular expression for parser\n    @callback - callback for regexp matching, it gets template name and view object as first 2 arguments and then arguments of the regexp match\n    Jinsoku.parser(name, regexp, callback);\n\nThe returned value from callback is used as replacer for regexp match.\n    \n## License\n\nThe MIT License\n\nCopyright © 2012 D.G. Shogun Shogun147@gmail.com\n\n\n\n\n\n\n\n\n\n","readmeFilename":"readme.md","_id":"jinsoku@0.2.2","dist":{"shasum":"7321da992cd292183393326bdc8fa3e15294116e","tarball":"https://registry.npmjs.org/jinsoku/-/jinsoku-0.2.2.tgz","integrity":"sha512-9BaJvaGJRXbYQ0pzJIXtnYfPuoee2gJ2SlaKMnKvycpvxIQmh+PABh1YTt2nMhk335Ws2zZArr5AVX1JQiQ8vg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDQimALy5FoTwYGpIeWryEAsey6ayHRLs+VbhIt9DFwwwIhALcrasCr5rOj23yG1dNNwgZAODnqSX202VfUUrKonYcE"}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"shogun","email":"Shogun147@gmail.com"},"maintainers":[{"name":"shogun","email":"Shogun147@gmail.com"}],"directories":{}},"0.2.3":{"name":"jinsoku","description":"High performance Javascript template engine inspired by Jade's power and doT's speed.","version":"0.2.3","author":{"name":"Shogun","email":"Shogun147@gmail.com","url":"http://github.com/Shogun147"},"keywords":["jinsoku","template","speed","jade","doT","view"],"repository":{"type":"git","url":"git://github.com/Shogun147/Jinsoku.git","web":"http://github.com/Shogun147/Jinsoku"},"bugs":{"url":"https://github.com/Shogun147/Jinsoku/issues"},"dependencies":{"cheerio":"*","async":"*"},"devDependencies":{},"main":"./jinsoku","engines":{"node":"> 0.6"},"readme":"# Jinsoku - template engine\n\nHigh performance Javascript template engine inspired by Jade's power and doT's speed.\n\n## Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Browser support](#browser-support)\n- [Public API](#public-api)\n    - [Options](#options)\n- [Syntax](#syntax)\n    - [Template inheritance](#template-inheritance)\n    - [Template includes](#includes)\n    - [Blocks](#blocks)\n    - [Array and Object iterators](#array-and-object-iterators)\n    - [Conditionals](#conditionals)\n- [Examples](#examples)\n- [Extending](#extending)\n- [License](#license)\n\n## Features\n\n- Template inheritance\n- Static includes\n- Asynchronous partials loading support\n- Blocks extending and cloning\n- Iterators and Conditionals\n- Extensible\n...\n\n## Installation\n\nvia npm:\n\n    npm install jinsoku\n\n### Browser support\n\nComming soon.\n\n## Public API\n\n* `resolve` resolve path to template files\n* `template` read templates content\n* `compile` compile template into function\n* `render` compile and run template\n\n```javascript\nvar Path = require('path');\nvar Fs   = require('fs');\n\nvar Jinsoku = require('jinsoku');\n\nvar root = process.cwd() + Path.sep;\n\n// resolve paths to template files\nJinsoku.resolve = function(path) {\n  return Path.join(root, 'views', path) + '.html';\n}\n\n// get template content from file system, cache or anythig else\nJinsoku.template = function(path, callback) {\n  var self = this;\n\n  path = self.resolve(path);\n\n  if (self.cache[path]) { callback(null, self.cache[path]); }\n\n  Fs.readFile(path, 'utf-8', function(error, content) {\n    if (error) { return callback(error); }\n\n    self.cache[path] = content;\n\n    callback(null, content);\n  });\n}\n\nvar path = 'home'; // this template path after resolving will be: /path/to/app/views/home.html\n\n// compile template to function\nJinsoku.compile(path, function(error, fn) {\n  if (error) { throw error; }\n\n  fn(data);\n});\n\n// render template\n// this will compile template and generated function\nJinsoku.render(path, function(error, content) {\n  log(error || content);\n});\n```\n\n### Options\n\n- `path`: `root +'views'+ Path.sep` Default root path for templates\n- `dataname`: `data` Locals variable object name\n- `extract`: `true` Extract data to local scope. If false, locals will be available as `dataname.varname`.\n- `cache`: `true` Cache files content.\n- `extension`: `.html` Default template file extension.\n\nTo set options we can call:\n```javascript\nJinsoku.set('cache', false);\n// or\nJinsoku.set({ cache: false, extension: '.tpl' });\n// or set them as data.options when call render\nvar data = {\n  ...\n  options: { cache: false }\n}\nJinsoku.render(path, data, ...);\n// as second argument for compile\nJinsoku.compile(path, { dataname: 'locals' }, ...);\n\n```\n\n## Syntax\nJinsoku allow different ways to define template.\n\n* As attributes\n\n```html\n\n// include partial into tag\n<head j:include=\"layout/head\"></head>\n<head js-include=\"layout/head\"></head>\n\n// each iterator over array\n<ul j:each=\"users :user\">\n  <li>#[user.username]</li>\n</ul>\n```\n\n* As `<js>` tag\n\n```html\n\n// extend some template\n<js extend=\"footer\"></js>\n\n// define a block\n<js block=\"scripts\"></js>\n```\n* With square brackets\n\n```html\n\n// simple include\n[include: auth/login]\n\n// array iterator\n[each:users :user:i]\n  #[i+1]. #[user.username]<br>\n[/each]\n```\n\n## Template inheritance\n\nJinsoku supports template inheritance via `extend` keyword.\n\nSuppose we have the following template content.html:\n```html\n<div id=\"content\">\n  <h2>Page title</h2>\n  <p>Page content</p>\n</div>\n```\n\nNow to extend this template in home.html:\n```html\n<body j:extend=\"content\">\n  <div id=\"copyright\">&copy; 2012 MyCompany</div>\n</body>\n```\n\nand result will be:\n```html\n<body>\n  <div id=\"content\">\n    <h2>Page title</h2>\n    <p>Page content</p>\n  </div>\n  <div id=\"copyright\">&copy; 2013 MyCompany</div>\n</body>\n```\n\n## Includes\n\nIncludes allow you to statically include parts of content.\n\nFor example home.html which has head and body in separate files:\n```html\n<!doctype html>\n<html lang=\"en-US\">\n  <head j:include=\"head\"></head>\n<body j:include=\"body\">\n  // or here [include: body]\n</body>\n</html>\n```\n\n## Blocks\n\nEach template could be splitted in more parts named blocks.Then after extending this template we may replace content of the blocks, prepend and append content, or even clone them.\n\nSuppose we have this head.html template:\n```html\n[block: meta]\n  <meta charset=\"utf-8\">\n[/block]\n<js block=\"scripts\">\n  <script type=\"text/javascript\" src=\"/public/scripts/jquery.js\"></script>\n</js>\n```\n\nnow in home.html to extend and add something to our head:\n```html\n<!doctype html>\n<html lang=\"en-US\">\n<head j:extend=\"head\">\n  <meta name=\"keywords\" content=\"Node.js, Javascript, HTML, CSS\" j:append=\"meta\">\n  <script type=\"text/javascript\" src=\"/public/scripts/app.js\" j:append=\"scripts\"></script>\n</head>\n<body>\n  Body content\n</body>\n</html>\n```\n\nthis will add meta tag to meta block and app.js script to scripts block so final home.html will look like so:\n```html\n<!doctype html>\n<html lang=\"en-US\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n  <script type=\"text/javascript\" src=\"/public/scripts/jquery.js\"></script>\n  <script type=\"text/javascript\" src=\"/public/scripts/app.js\"></script>\n</head>\n<body>\n  Body content\n</body>\n</html>\n```\n\nTo replace a block we need just to redefine it:\n```html\n// replace scripts block\n<head j:extend=\"head\">\n  [block: scripts]\n  <script src=\"/public/scripts/main.js\"></script>\n  [/block]\n</head>\n// now scripts block will contain only main.js script \n```\n\n## Array and Object iterators\n\nJinsoku also supports friendly iterators over arrays(each) and objects(for).\n\nFor arrays:\nvar items = ['one', 'two', 'three', 'four'];\n\n```html\n<ul j:each=\"items :item:i\">\n  <li>#[i]. #[item]</li>\n</ul>\n\n// or\n<js each=\"items :item:i\">\n  #[i]. #[item]<br>\n</js>\n\n// or\n[each:items :item:i]\n  #[i]. #[item]<br>\n[/each]\n```\n`i` is current index, optional\n\nFor objects:\nvar obj = { foo: 'bar' };\n\n```html\n<ul j:for=\"obj :value:key\">\n  <li>#[key]: #[value]</li>\n</ul>\n\n// or\n<js for=\"obj :value:key\">\n  #[key]: #[value]<br>\n</js>\n\n// or\n[for:obj :value:key]\n  #[key]: #[value]<br>\n[/for]\n```\n\n## Conditionals\n\nJinsoku has shortcut support for `if` and `switch` statements.\n```html\n[if: User.logged_in]              // if (User.logged_in) {\n  Welcome back, #[User.username]!\n[: User.banned]                   // else if (User.banned) {\n  Access denied, you are banned!\n[:]                               // else {\n  Hello guest, please login!\n[/if]                             // }\n\n[case: User.role]                      // switch(User.role) {\n  [:'administrator']                   // case 'administrator':\n    #[User.username] is administrator.\n  [:'moderator']                       // break; case 'moderator':\n    #[User.username] is moderator.\n  [:]                                  // break; default:\n    #[User.username] is user.\n[/case]                                // break; }\n```\n\n## Variables\n\n```html\n// simple\n<h2>#[page.title]</h2>\n\n// escape html\n<p>![page.content]</p>\n\n// set a variable\n#[page.title:'Jinsoku Template Engine']\n```\n\n#### Unbuffered code for conditionals and anything else\n```html\n[# var keywords = ['template', 'mvc', 'dom', 'node.js']; #]\n\n[# if (keywords.indexOf('mvc')) { #]\n  Yahooo!\n[# } else { #]\n  Ooops!\n[# } #]\n```\n\n## Examples\n\n\n## Extending\n\nYou can easily extend jinsoku by adding new or replace one of the  existing parsers(if, case, each, for, var, evaluate).\n\nTo register a parser:\n```javascript\nJinsoku.parser(function(template, next) {\n  // do what you need with template\n  // call next parser\n  next(null, template);\n});\n```\n\n## License\n\nThe MIT License\n\nCopyright © 2013 D.G. Shogun147@gmail.com\n\n\n\n\n\n\n\n\n\n","readmeFilename":"readme.md","_id":"jinsoku@0.2.3","dist":{"shasum":"fcfb7cc69863103025a9538318da60fb036c7738","tarball":"https://registry.npmjs.org/jinsoku/-/jinsoku-0.2.3.tgz","integrity":"sha512-gfAURSsLiW8cNd8kJW7NifngiJK5DMUbvXLL0xd8mq/x1/wuLCqcbfj4GQpKsN9KrwMgJK6PutLwbWybMvzf3Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEb155ShD4GgEAf4iKFAjSeBfYyA/qs82MnVdBjxmCCrAiEA8hCqm7WbBYzOzKGOqZhfn3YDHaOOBgD8pfZl8kfOaP4="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"shogun","email":"Shogun147@gmail.com"},"maintainers":[{"name":"shogun","email":"Shogun147@gmail.com"}]},"0.2.4":{"name":"jinsoku","description":"High performance Javascript template engine inspired by Jade's power and doT's speed.","version":"0.2.4","author":{"name":"Shogun","email":"Shogun147@gmail.com","url":"http://github.com/Shogun147"},"keywords":["jinsoku","template","speed","jade","doT","view"],"repository":{"type":"git","url":"git://github.com/Shogun147/Jinsoku.git","web":"http://github.com/Shogun147/Jinsoku"},"bugs":{"url":"https://github.com/Shogun147/Jinsoku/issues"},"dependencies":{"cheerio":"*","async":"*"},"devDependencies":{},"main":"./jinsoku","engines":{"node":"> 0.6"},"readme":"# Jinsoku - template engine\n\nHigh performance Javascript template engine inspired by Jade's power and doT's speed.\n\n## Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Browser support](#browser-support)\n- [Public API](#public-api)\n    - [Options](#options)\n- [Syntax](#syntax)\n    - [Template inheritance](#template-inheritance)\n    - [Template includes](#includes)\n    - [Blocks](#blocks)\n    - [Array and Object iterators](#array-and-object-iterators)\n    - [Conditionals](#conditionals)\n- [Examples](#examples)\n- [Extending](#extending)\n- [License](#license)\n\n## Features\n\n- Template inheritance\n- Static includes\n- Asynchronous partials loading support\n- Blocks extending and cloning\n- Iterators and Conditionals\n- Extensible\n...\n\n## Installation\n\nvia npm:\n\n    npm install jinsoku\n\n### Dependencies\n\nJinsoku requires only 2 libs:\nFor Node.js:\n\n* Async\n* Cheerio\n\nFor browser:\n\n* Async\n* jQuery\n\n## Browser support\n\n```html\n<script src=\"/public/scripts/jquery.js\"></script>\n<script src=\"/public/scripts/async.js\"></script>\n<script src=\"/public/scripts/jinsoku.js\"></script>\n<script>\n  // by default it will look in http[s]://hostname/public/views/ path to read templates\n  // so this will load http://hostname/public/views/home.html\n  Jinsoku.render('home', function(error, content) {\n    console.log(error || content);\n  });\n</script>\n```\nTemplates are loaded with `jQuery.ajax` method by default.\nSame as on Node.js we can replace `Jinsoku.resolve` and `Jinsoku.template` methods with our custom. This make Jinsoku pretty easy to integrate into any web application or framework.\n\nPlease note that by default jQuery will execute any `<script>` that will be found in your templates content.\n\n## Public API\n\n* `resolve` resolve path to template files\n* `template` read templates content\n* `compile` compile template into function\n* `render` compile and run template\n\n```javascript\nvar Path = require('path');\nvar Fs   = require('fs');\n\nvar Jinsoku = require('jinsoku');\n\nvar root = process.cwd() + Path.sep;\n\n// resolve paths to template files\nJinsoku.resolve = function(path) {\n  return Path.join(root, 'views', path) + '.html';\n}\n\n// get template content from file system, cache or anythig else\nJinsoku.template = function(path, callback) {\n  var self = this;\n\n  path = self.resolve(path);\n\n  if (self.cache[path]) { callback(null, self.cache[path]); }\n\n  Fs.readFile(path, 'utf-8', function(error, content) {\n    if (error) { return callback(error); }\n\n    self.cache[path] = content;\n\n    callback(null, content);\n  });\n}\n\nvar path = 'home'; // this template path after resolving will be: /path/to/app/views/home.html\n\n// compile template to function\nJinsoku.compile(path, function(error, fn) {\n  if (error) { throw error; }\n\n  fn(data);\n});\n\n// render template\n// this will compile template and generated function\nJinsoku.render(path, function(error, content) {\n  log(error || content);\n});\n```\n\n### Options\n\n- `path`: `root +'views'+ Path.sep` Default root path for templates\n- `dataname`: `data` Locals variable object name\n- `extract`: `true` Extract data to local scope. If false, locals will be available as `dataname.varname`.\n- `cache`: `true` Cache files content.\n- `extension`: `.html` Default template file extension.\n\nTo set options we can call:\n```javascript\nJinsoku.set('cache', false);\n// or\nJinsoku.set({ cache: false, extension: '.tpl' });\n// or set them as data.options when call render\nvar data = {\n  ...\n  options: { cache: false }\n}\nJinsoku.render(path, data, ...);\n// as second argument for compile\nJinsoku.compile(path, { dataname: 'locals' }, ...);\n\n```\n\n## Syntax\nJinsoku allow different ways to define template.\n\n* As attributes\n\n```html\n\n// include partial into tag\n<head j:include=\"layout/head\"></head>\n<head j-include=\"layout/head\"></head>\n\n// each iterator over array\n<ul j:each=\"users :user\">\n  <li>#[user.username]</li>\n</ul>\n```\n\n* As `<j>` tag\n\n```html\n\n// extend some template\n<j extend=\"footer\"></j>\n\n// define a block\n<j block=\"scripts\"></j>\n```\n* With square brackets\n\n```html\n\n// simple include\n[include: auth/login]\n\n// array iterator\n[each:users :user:i]\n  #[i+1]. #[user.username]<br>\n[/each]\n```\n\n## Template inheritance\n\nJinsoku supports template inheritance via `extend` keyword.\n\nSuppose we have the following template content.html:\n```html\n<div id=\"content\">\n  <h2>Page title</h2>\n  <p>Page content</p>\n</div>\n```\n\nNow to extend this template in home.html:\n```html\n<body j:extend=\"content\">\n  <div id=\"copyright\">&copy; 2012 MyCompany</div>\n</body>\n```\n\nand result will be:\n```html\n<body>\n  <div id=\"content\">\n    <h2>Page title</h2>\n    <p>Page content</p>\n  </div>\n  <div id=\"copyright\">&copy; 2013 MyCompany</div>\n</body>\n```\n\n## Includes\n\nIncludes allow you to statically include parts of content.\n\nFor example home.html which has head and body in separate files:\n```html\n<!doctype html>\n<html lang=\"en-US\">\n  <head j:include=\"head\"></head>\n<body j:include=\"body\">\n  // or here [include: body]\n</body>\n</html>\n```\n\n## Blocks\n\nEach template could be splitted in more parts named blocks.Then after extending this template we may replace content of the blocks, prepend and append content, or even clone them.\n\nSuppose we have this head.html template:\n```html\n[block: meta]\n  <meta charset=\"utf-8\">\n[/block]\n<j block=\"scripts\">\n  <script type=\"text/javascript\" src=\"/public/scripts/jquery.js\"></script>\n</j>\n```\n\nnow in home.html to extend and add something to our head:\n```html\n<!doctype html>\n<html lang=\"en-US\">\n<head j:extend=\"head\">\n  <meta name=\"keywords\" content=\"Node.js, Javascript, HTML, CSS\" j:append=\"meta\">\n  <script type=\"text/javascript\" src=\"/public/scripts/app.js\" j:append=\"scripts\"></script>\n</head>\n<body>\n  Body content\n</body>\n</html>\n```\n\nthis will add meta tag to meta block and app.js script to scripts block so final home.html will look like so:\n```html\n<!doctype html>\n<html lang=\"en-US\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n  <script type=\"text/javascript\" src=\"/public/scripts/jquery.js\"></script>\n  <script type=\"text/javascript\" src=\"/public/scripts/app.js\"></script>\n</head>\n<body>\n  Body content\n</body>\n</html>\n```\n\nTo replace a block we need just to redefine it:\n```html\n// replace scripts block\n<head j:extend=\"head\">\n  [block: scripts]\n  <script src=\"/public/scripts/main.js\"></script>\n  [/block]\n</head>\n// now scripts block will contain only main.js script \n```\n\n## Array and Object iterators\n\nJinsoku also supports friendly iterators over arrays(each) and objects(for).\n\nFor arrays:\nvar items = ['one', 'two', 'three', 'four'];\n\n```html\n<ul j:each=\"items :item:i\">\n  <li>#[i]. #[item]</li>\n</ul>\n\n// or\n<j each=\"items :item:i\">\n  #[i]. #[item]<br>\n</j>\n\n// or\n[each:items :item:i]\n  #[i]. #[item]<br>\n[/each]\n```\n`i` is current index, optional\n\nFor objects:\nvar obj = { foo: 'bar' };\n\n```html\n<ul j:for=\"obj :value:key\">\n  <li>#[key]: #[value]</li>\n</ul>\n\n// or\n<j for=\"obj :value:key\">\n  #[key]: #[value]<br>\n</j>\n\n// or\n[for:obj :value:key]\n  #[key]: #[value]<br>\n[/for]\n```\n\n## Conditionals\n\nJinsoku has shortcut support for `if` and `switch` statements.\n```html\n[if: User.logged_in]              // if (User.logged_in) {\n  Welcome back, #[User.username]!\n[: User.banned]                   // else if (User.banned) {\n  Access denied, you are banned!\n[:]                               // else {\n  Hello guest, please login!\n[/if]                             // }\n\n[case: User.role]                      // switch(User.role) {\n  [:'administrator']                   // case 'administrator':\n    #[User.username] is administrator.\n  [:'moderator']                       // break; case 'moderator':\n    #[User.username] is moderator.\n  [:]                                  // break; default:\n    #[User.username] is user.\n[/case]                                // break; }\n```\n\n## Variables\n\n```html\n// simple\n<h2>#[page.title]</h2>\n\n// escape html\n<p>![page.content]</p>\n\n// set a variable\n#[page.title:'Jinsoku Template Engine']\n```\n\n#### Unbuffered code for conditionals and anything else\n```html\n[# var keywords = ['template', 'mvc', 'dom', 'node.js']; #]\n\n[# if (keywords.indexOf('mvc')) { #]\n  Yahooo!\n[# } else { #]\n  Ooops!\n[# } #]\n```\n\n## Examples\nWe could combine some of the statements:\n```html\n// main file\n<section id=\"articles\" j:each=\"articles :article\" j:include=\"article\"> \n  // the article.html partial will be included here\n</section>\n\n// article.html file\n<article>\n  <h2>#[article.title]</h2>\n  <p>#[article.description]</p>\n</article>\n```\n\n## Extending\n\nYou can easily extend jinsoku by adding new or replace one of the  existing parsers(if, case, each, for, var, evaluate).\n\nTo register a parser:\n```javascript\nJinsoku.parser(function(template, next) {\n  // do what you need with template\n  // call next parser\n  next(null, template);\n});\n```\n\n## License\n\nThe MIT License\n\nCopyright © 2013 D.G. Shogun147@gmail.com\n\n\n\n\n\n\n\n\n\n","readmeFilename":"readme.md","_id":"jinsoku@0.2.4","dist":{"shasum":"3eaaf86b0ee60e8de563390849194c0d477cd72b","tarball":"https://registry.npmjs.org/jinsoku/-/jinsoku-0.2.4.tgz","integrity":"sha512-+jnVg+6Mff9CKk25c0vQxRX/KgmEd7pGbvTRnDp6UTrgO50PhNG8Uxmyhx2BlUpK6AWxAuNReGtUXUqdBB0Wbg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGMThBicTAPqncGFSI8JQ2LeG9iip2/lK5Tewa11upR5AiEAty7gkxYy00Wqfu2rSqILTLk63dnMXPpEe/act3se3G8="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"shogun","email":"Shogun147@gmail.com"},"maintainers":[{"name":"shogun","email":"Shogun147@gmail.com"}]}},"readme":"# Jinsoku - template engine\n\nHigh performance Javascript template engine inspired by Jade's power and doT's speed.\n\n## Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Browser support](#browser-support)\n- [Public API](#public-api)\n    - [Settings](#options)\n- [Syntax](#syntax)\n    - [Template inheritance](#template-inheritance)\n    - [Template includes](#includes)\n    - [Block extending/clone/prepend/append](#blocks)\n    - [Array and Object iterators](#array-and-object-iterators)\n    - [Conditionals](#conditionals)\n- [Examples](#examples)\n- [Extending](#extending)\n- [License](#license)\n\n## Features\n\n- Fast & Furious\n- Client-side support\n- Template inheritance\n- Static includes\n- Asynchronous partials loading support\n- Blocks extending and cloning\n- Iterators and Conditionals\n- Extensible\n\n## Installation\n\nvia npm:\n\n    npm install jinsoku\n\n### Browser support\n\nJinsoku has no dependencies so you could just require it.\n\n## Public API\n\nBefore compile something we need to set `Jinsoku.template` function, this is used to get content for a template path. It also support async loading.\n\nEx. node.js:\n\n    var path    = process.cwd() + '/views/';\n    var Fs      = require('fs');\n    var Jinsoku = require('jinsoku');\n\n    // @template - template path, [include: this/is/path] or [extend: view/path]\n    // @callback - a callback which get template content as argument\n    Jinsoku.template = function(template, callback) {\n      Fs.readFile(path + template + '.html', 'utf-8', function(error, content) {\n        callback(content);\n      })\n    };\n\nEx. browser:\n\n    <script type=\"text/javascript\" src=\"/jinsoku.js\"></script>\n    <script type=\"text/javascript\">\n      Jinsoku.template = function(template, callback) {\n        // use jQuery ajax call\n        $.ajax({\n          url: '/views/'+template+'.html'\n        }).done(function(content) {\n          callback(content);\n        });\n      }\n    </script>\n\nThen we can compile templates:\n\n    // For sync templates loading compiled function is also returned\n    var fn = Jinsoku.compile('home'); // home.html template\n\n    fn(locals);\n\n    // but for async loading we must wait it from callback\n    Jinsoku.compile('home', function(fn) {\n      fn(locals);\n    });\n\n### Options\n\nBefore compile you could set some options in `Jinsoku.settings`:\n\n- `strip`: `true` - Strip whitespaces of the html output or not.\n- `dataname`: `data` - Locals variable object.\n- `extract`: `false` - Extract locals to local scope. When `true` locals are available directly, without `dataname` prefix, but compiled function will run slower.\n- `import_deps`: `true` - If dependencies should be included in compiled template or not.\n- `wrap`: `false` - Wrap function into a scope or not, if `false` then `this` is global scope.\n- `scope`: `{}` - The scope in which fn runs if `wrap=true`.\n\n## Template inheritance\n\nJinsoku supports template inheritance via `extend` keyword.\n\nSuppose we have the following template content.html:\n\n    <div id=\"content\">\n      <h2>Page title</h2>\n      <p>Page content</p>\n    </div>\n\nNow to extend this template in home.html:\n\n    [extend: content]\n      <div id=\"copyright\">&copy; 2012 MyCompany</div>\n    [/extend]\n\nand result will be:\n\n    <div id=\"content\">\n      <h2>Page title</h2>\n      <p>Page content</p>\n    </div>\n    <div id=\"copyright\">&copy; 2012 MyCompany</div>\n\nWe could extend more templates at the same time which will compile to one bigger.\n\nFor example home.html:\n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n      <head>\n        [extend: head]\n          <title>Jinsoku Template Engine</title>\n        [/extend]\n      </head>\n    <body>\n      [extend: top][/extend]\n  \n      [extend: content][/extend]\n  \n      [extend: footer][/extend]\n    </body>\n    </html>\n\n## Includes\n\nIncludes allow you to statically include parts of content.\n\nFor example home.html which has body in separate file:\n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n      <head>\n        [extend: head]\n          <title>Jinsoku Template Engine</title>\n        [/extend]\n      </head>\n    <body>\n      [include: body]\n    </body>\n    </html>\n\nand body.html:\n\n    [extend: top][/extend]\n  \n    [extend: content][/extend]\n  \n    [extend: footer][/extend]\n\n## Blocks\n\nEach template could be splitted in more parts named blocks.Then after we extend this template we may replace content of the blocks, prepend and append content, or even clone them.\n\nSuppose we have this head.html template:\n\n    <head>\n      [block: meta]\n        <meta charset=\"utf-8\">\n      [/block]\n      [block: scripts]\n        <script type=\"text/javascript\" src=\"/public/scripts/jquery.js\"></script>\n      [/block]\n    </head>\n\nnow in home.html to extend and add something to our head:\n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n    [extend: head]\n      [append: meta]\n        <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n      [/append]\n      [append: scripts]\n        <script type=\"text/javascript\" src=\"/public/scripts/app.js\"></script>\n      [/append]\n    [/extend]\n    <body>\n      Body content\n    </body>\n    </html>\n\nthis will add meta tag to meta block and app.js script to scripts block so final home.html will look like: \n\n    <!DOCTYPE HTML>\n    <html lang=\"en-US\">\n    <head>\n      <meta charset=\"utf-8\">\n      <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n      <script type=\"text/javascript\" src=\"/public/scripts/jquery.js\"></script>\n      <script type=\"text/javascript\" src=\"/public/scripts/app.js\"></script>\n    </head>\n    <body>\n      Body content\n    </body>\n    </html>\n\nTo replace a block we need just to redefine it:\n\n    [extend: head]\n      [block: meta]\n        <meta name=\"keywords\" content=\"Node.js, JavaScript, HTML, CSS\">\n      [/block]\n    [/extend]\n\nNow meta block will contain only meta keywords without the charset.\n\nThere also is the possibility to clone a block at the same time. To do this just add exclamation mark after block name and the block will be cloned in this place.\n\n    [append: menu!]\n      <li><a href=\"/about\">About</a></li>\n    [/append]\n\nThis will append new item to the menu and clone entire menu in this place.\n\nTo just clone a block use `clone`:\n\n    [clone: pagination]\n\n## Array and Object iterators\n\nJinsoku also supports friendly iterators over arrays(each) and objects(for).\n\nFor arrays:\n\n    [# var items = ['one', 'two', 'three', 'four']; #]\n\n    [each:items :item]\n      <li>#[item]</li>\n    [/each]\n    \n    //result\n    <li>one</li>\n    <li>two</li>\n    <li>three</li>\n    <li>four</li>\n\n    //with index:\n    [each:items :item:i]\n      <li>#[i+1]. #[item]</li>\n    [/each]\n\n    //result\n    <li>1. one</li>\n    <li>2. two</li>\n    <li>3. three</li>\n    <li>4. four</li>\n\nFor objects:\n\n    [# var obj = { foo: 'bar' }; #]\n\n    [for:obj :value:key]\n      <li>#[key]: #[value]</li>\n    [/for]\n\n    //result\n    <li>foo: bar</li>\n\n## Conditionals\n\nJinsoku has shortcut support for `if` and `switch` statements.\n\n    [if: User.logged_in]              // if (User.logged_in) {\n      Welcome back, #[User.username]!\n    [: User.banned]                   // else if (User.banned) {\n      Access denied, you are banned!\n    [:]                               // else {\n      Hello guest, please login!\n    [/if]                             // }\n\n    [case: User.role]                      // switch(User.role) {\n      [:'administrator']                   // case 'administrator':\n        #[User.username] is administrator.\n      [:'moderator']                       // break; case 'moderator':\n        #[User.username] is moderator.\n      [:]                                  // break; default:\n        #[User.username] is user.\n    [/case]                                // break; }\n\n\n## Examples\n\nOne more complex example:\n\n## Extending\n\nYou can easily extend jinsoku by adding new or replace one of the  existing parsers(if, case, each, for, var, evaluate).\n\nTo register a parser:\n\n    @name - parser name, if the parser with same name already exists then he will be replaced by this one\n    @regexp - regular expression for parser\n    @callback - callback for regexp matching, it gets template name and view object as first 2 arguments and then arguments of the regexp match\n    Jinsoku.parser(name, regexp, callback);\n\nThe returned value from callback is used as replacer for regexp match.\n    \n## License\n\nThe MIT License\n\nCopyright © 2012 D.G. Shogun Shogun147@gmail.com\n\n\n\n\n\n\n\n\n\n","maintainers":[{"name":"shogun","email":"Shogun147@gmail.com"}],"time":{"modified":"2022-06-19T04:27:36.693Z","created":"2012-11-30T19:02:34.454Z","0.1.0":"2012-11-30T19:02:36.800Z","0.2.0":"2013-07-02T13:23:47.817Z","0.2.1":"2013-07-04T20:43:24.343Z","0.2.2":"2013-07-06T12:38:21.662Z","0.2.3":"2013-07-10T23:49:37.363Z","0.2.4":"2013-07-16T15:42:04.381Z"},"author":{"name":"Shogun","email":"Shogun147@gmail.com","url":"http://github.com/Shogun147"},"repository":{"type":"git","url":"git://github.com/Shogun147/Jinsoku.git","web":"http://github.com/Shogun147/Jinsoku"}}