{"_id":"templify","_rev":"7-67c24d563a60a669d921b50b1a9742dd","name":"templify","description":"A simple template system originally based on zparse","dist-tags":{"latest":"0.9.1"},"versions":{"0.9.0":{"name":"templify","version":"0.9.0","description":"A simple template system originally based on zparse","url":"http://github.com/dmachi/templify","keywords":["template","persevere"],"author":{"name":"Dustin Machi"},"email":"dmachi@dojotoolkit.org","githubName":"templify","type":"zip","location":"http://github.com/dmachi/templify/zipball/master","license":"AFL/BSD","engines":{"node":">=0.1.30","rhino":true},"dependencies":{"perstore":">=0.3.0"},"mappings":{"promised-io":"jar:http://github.com/kriszyp/promised-io/zipball/master!/","perstore":"jar:http://github.com/kriszyp/perstore/zipball/master!/lib/"},"maintainers":[{"name":"dojofoundation","email":"kzyp@dojofoundation.org"}],"overlay":{"narwhal":{"mappings":{"fs-promise":"./engines/rhino/lib/fs-promise","store-engine":"./engines/rhino/lib/store-engine/"}},"node":{"mappings":{"store-engine":"./engines/node/lib/store-engine/"}},"npm":{"dependencies":{"commonjs-utils":"*"}}},"_npmUser":{"name":"dojofoundation","email":"kzyp@dojofoundation.org"},"_id":"templify@0.9.0","devDependencies":{},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.0","_defaultsLoaded":true,"dist":{"shasum":"dede0f3f3fba5df73eb0a4e4abd136bb853f3611","tarball":"https://registry.npmjs.org/templify/-/templify-0.9.0.tgz","integrity":"sha512-rPdm3OwHGZontbsU1KxcYgny4lt1LzgQ6gc5vWYFV4POoG8PXNYIskYuiTtd2E8NCWVCoC7qpKid4MdNTZvPIg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE6lpEWXFFENhCbF7aAy+nuRCeP1PhAwl+zO3yMeEJ5GAiEA5EeobbABKORmTK1Ds0DrEHo81r+H33iIZCymt1T8030="}]}},"0.9.1":{"name":"templify","version":"0.9.1","description":"A simple template system originally based on zparse","url":"http://github.com/dmachi/templify","keywords":["template","persevere"],"author":{"name":"Dustin Machi"},"email":"dmachi@dojotoolkit.org","githubName":"templify","type":"zip","location":"http://github.com/dmachi/templify/zipball/master","license":"AFL/BSD","engines":{"node":">=0.1.30","rhino":true},"dependencies":{"perstore":">=0.3.0"},"mappings":{"promised-io":"jar:http://github.com/kriszyp/promised-io/zipball/master!/","perstore":"jar:http://github.com/kriszyp/perstore/zipball/master!/lib/"},"maintainers":[{"name":"dojofoundation","email":"kzyp@dojofoundation.org"}],"overlay":{"narwhal":{"mappings":{"fs-promise":"./engines/rhino/lib/fs-promise","store-engine":"./engines/rhino/lib/store-engine/"}},"node":{"mappings":{"store-engine":"./engines/node/lib/store-engine/"}},"npm":{"dependencies":{"commonjs-utils":"*"}}},"gitHead":"13c124cb1208a2c5986bb5fd8af521f8aad57d91","_id":"templify@0.9.1","scripts":{},"_shasum":"2c19ca439ac8ba37f0b135adb28a43b267a36b18","_from":".","_npmVersion":"3.5.3","_nodeVersion":"4.2.4","_npmUser":{"name":"dojofoundation","email":"kriszyp@gmail.com"},"dist":{"shasum":"2c19ca439ac8ba37f0b135adb28a43b267a36b18","tarball":"https://registry.npmjs.org/templify/-/templify-0.9.1.tgz","integrity":"sha512-sxIZ8eCNZ5RX24VrOCucOXieFXylWe7zOBaukLJKMyV3O8mam0620/EsBgMKcPoOf7O37q0DwcAyoRPvjVXf6A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBU2hS2kubnk/Rc5152W1lx3AXqGv857fQEkA94Q1FxNAiBUsoMKLlsb0tsV0K3/JvBoItFibmZRNYL7Bu2WzDk+7Q=="}]}}},"readme":"templify is a small template system written in javascript.  \r\n\r\n##Example use:\r\n\r\nInstantiate a template (which returns a function), and render the template by passing it a context\r\n\r\n    node>var template = require(\"templify/template\").Template;\r\n    node>var compiled = template(\"{{foo}}\");\r\n    node>compiled({foo: \"test me\"});\r\n    'test me'\r\n\r\nCombined compile/render with renderTemplate()\r\n\r\n    node>var rt = require(\"templify/templify\").renderTemplate;\r\n    node>rt(\"{{foo}}\",{foo: \"blah\"});\r\n    'blah'\r\n\r\nAn example of using templify to create a media handler can be seen in the Pintura package's html media handler. It looks something like this:\r\n\r\n\t//load a store where we will retrieve our templates\r\n    \tfilesystem = require(\"perstore/store/filesystem\").FileSystem({fsRoot: \"templates\"}),\r\n\r\n\t//setup a resolver, in this case we're just using the default\r\n\tresolver = require(\"templify/templify\").Resolver;\r\n\r\n\t// instantiate a template engine\r\n        var templateEngine =  require('templify/templify').TemplateEngine({resolver: resolver, store: filesystem});\r\n\r\n\t//use the template engine to render an object as html\r\n\r\n        var template = templateEngine.compile(templateId);\r\n\trendered = template(object);\r\n       \t \r\n\r\n##Template Syntax:\r\n\r\n###Statements:\r\n\r\n\tStatements are opened and closed with {% and %} by default and are in the form : {%someStatement args%}\r\n\r\n* extend `{%extend fooTemplate%}` extents one template from another.  When using an extension, the base template is used and any blocks provided by the extender override blocks in the base class\r\n\r\n* block `{%block someBlock%}` - Defines a block, which extends an existing block or can be extended by someone who extends in the future\r\n\r\n* include `{%include fooTemplate%}` include one template from another.  include, as with extend, block, and render use the resolver to transform a referenced template to an actual template string.\r\n\r\n* render - `{%render fooTemplate with someObj%} similar to include, this allows another template to be loaded.  However, instead of using the existing context as the root, a root context is provided.\r\n\r\n* foreach - `{%foreach element in object%} {{element.name}}{%/foreach%}   Loops over arrays \r\n\r\n* for `{%for element in object%}{{element.name}}{%/for%} loops over objects\r\n\r\n* if `{%if condition%} .... {%/if%}   conditional, i'm guessing few people read this doc without being able to guess what this does :)\r\n\r\n* else/elseif `{%if condition%} .... {%/if%}{%elseif condition%} ... {%/elseif%}{%else%} ... {%/else%}\r\n\r\n* cdata `{%cdata} ..... {%/cdata} Escape's content\r\n\r\n\r\n\r\n### Print\r\n\r\nPrinting can be achieved by using ${variable}}  or {{variable}} \r\n\r\n\r\n### Script\r\n\r\nScripts can be included by wrappting them in <% %>\r\n\r\n    <%  \r\n       foo.bar=baz;\r\n    %>\r\n\r\n\r\n### Comments\r\n\r\nComments are included by wrapping them with {#  #}.  Currently, this is configured to output comments surrounded by <!-- --> in the final html to ease debugging.\r\n","maintainers":[{"name":"dojofoundation","email":"kzyp@dojofoundation.org"}],"time":{"modified":"2022-06-27T04:42:56.589Z","created":"2011-11-16T17:30:48.942Z","0.9.0":"2011-11-16T17:30:49.852Z","0.9.1":"2016-01-20T21:44:22.637Z"},"author":{"name":"Dustin Machi"},"users":{"fgribreau":true},"keywords":["template","persevere"],"license":"AFL/BSD","readmeFilename":"README"}