{"name":"trisquel","version":"0.4.0","description":"JS template engine","main":"lib/template.js","repository":{"type":"git","url":"git+ssh://git@github.com/kiltjs/trisquel.git"},"keywords":["javascript","trisquel","template","templates","demo"],"author":{"name":"Jesús Manuel Germade Castiñeiras","email":"jesus@germade.es"},"license":"MIT","bugs":{"url":"https://github.com/kiltjs/trisquel/issues"},"homepage":"https://github.com/kiltjs/trisquel","devDependencies":{"mocha":"^3.2.0"},"directories":{"lib":"./lib"},"scripts":{"test":"$(npm bin)/mocha tests"},"dependencies":{},"gitHead":"0e34412515cb4d56f2ebf594f9ee7c963ebbf949","_id":"trisquel@0.4.0","_shasum":"bb1529952bbc2fe5f64a5f0de37a74988b8f878a","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"jgermade","email":"jesus@germade.es"},"dist":{"shasum":"bb1529952bbc2fe5f64a5f0de37a74988b8f878a","tarball":"http://registry-npm.ywwl.com/trisquel/download/trisquel-0.4.0.tgz","integrity":"sha512-cSy5j2xihDvGQOiV2go+xWfp7vwrmRukYMDkji+GZH/qVvkljbGHvyUWurm8vfD4KHP0Tc1Ul89+QHub3rNkWw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAJffTYSkBLwb4inKqnsL5htmOcAak0uSdEyb0F+Z1zJAiB/OeYkIHDeVJbiAGQIDTHy+tP1/chmkliFjlatrYu4kg=="}],"size":6259,"noattachment":false,"key":"/trisquel/-/trisquel-0.4.0.tgz"},"maintainers":[{"name":"jgermade","email":"jesus@germade.es"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/trisquel-0.4.0.tgz_1482171362179_0.8012354623060673"},"readme":"# trisquel\n\nSimple, customizable template engine for JavaScript\n\n[![](https://img.shields.io/npm/v/trisquel.svg)](https://www.npmjs.com/package/trisquel)\n[![Build Status](https://travis-ci.org/kiltjs/trisquel.svg?branch=master)](https://travis-ci.org/kiltjs/trisquel)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\n### Installation\n\n```.sh\nnpm install trisquel --save\n```\n\n> Example data\n\n``` js\nvar data = {\n  foo: 'bar',\n  crash: {\n    test: 'dummy'\n  },\n  list: ['foo', 'bar', 'foobar'],\n  map: {\n    hi: 'all',\n    bye: 'nobody'\n  }\n};\n```\n\n#### Caching templates\n\n``` js\ntemplate.put('partial-map', '$each{ item,key in map }[${foo}:${key}:${item}]{/}');\n\ntemplate.put('partial-list', '$each{ item,i in list }[${foo}:${i}:${item}]{/}');\n\n// cached templates can be invoked with $include{}\n\nconsole.log( template('$if{ foo !== \\'bar\\' }whoops{:}map: $include{\\'partial-map\\'} {/}', data) );\n// returns 'map: [bar:hi:all][bar:bye:nobody]'\n\nconsole.log( template('$if{ foo !== \\'bar\\' }whoops{:}list: $include{\\'partial-list\\'} {/}', data) );\n// returns 'list: [bar:0:foo][bar:1:bar][bar:2:foobar]'\n```\n\n#### Filters\n\n``` js\n\ntemplate.filter('months', function (nMonths) {\n  return nMonths + (nMonths > 1 ? ' meses' : ' mes' );\n});\n\nconsole.log( template('${ nMonths | months }')({ nMonths: 5 }) );\n// returns '5 meses'\nconsole.log( template('${ nMonths | months }')({ nMonths: 1 }) );\n// returns '1 mes'\n```\n\n``` js\n\nvar messages {\n  greeting: template('Hi ${name}!')\n};\n\ntemplate.filter('message', function (key, data) {\n  return messages[key](data);\n});\n\nconsole.log( template('${ person.last_name }: ${ \\'greeting\\' | message: { name: person.first_name } }')({\n  person: {\n    first_name: 'John',\n    last_name: 'Smith'\n  }\n}) );\n// returns 'Smith: Hi John!'\n```\n\n#### Tests\n\n``` sh\nnpm test\n```\n\n[![Build Status](https://travis-ci.org/kiltjs/trisquel.svg?branch=master)](https://travis-ci.org/kiltjs/trisquel) Travis\n\n[![wercker status](https://app.wercker.com/status/281f306e7157005f0a21b770fbb81086/s \"wercker status\")](https://app.wercker.com/project/bykey/281f306e7157005f0a21b770fbb81086) Wercker\n","publish_time":1482171362743,"_cnpm_publish_time":1482171362743,"dist-tags":{"latest":"1.1.5"}}