{"name":"trisquel","version":"1.1.2","description":"JS template engine","main":"dist/trisquel.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":{"eslint":"^3.19.0","mocha":"^3.2.0","rollup":"^0.37.0","uglify-js":"^2.7.5"},"scripts":{"test":"make test"},"dependencies":{},"gitHead":"329d01fb48c85d8de93395c70dd3af39d8854d08","_id":"trisquel@1.1.2","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"jgermade","email":"jesus@germade.es"},"dist":{"integrity":"sha512-T74PZqAc4yUB8E5vx8qo1qRQRS4MVsTvrwWSBzDOTLSd/nNK1JWhyHKyq/QCystoWL6a1S/nBv9FubYKqRkvdQ==","shasum":"cec427181e284c76cfceeaa0ff90f479b1174174","tarball":"http://registry-npm.ywwl.com/trisquel/download/trisquel-1.1.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGcFogm32MRa6bkKxZlaEFETq7alYGSuIvxL5zo103DNAiEA/v2jXgHo/41BrPXMcVHuIpsHeyohlRV2oBJbfg4Zkac="}],"size":9652,"noattachment":false,"key":"/trisquel/-/trisquel-1.1.2.tgz"},"maintainers":[{"name":"jgermade","email":"jesus@germade.es"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/trisquel-1.1.2.tgz_1517930019064_0.4235747957136482"},"directories":{},"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":1517930020025,"_cnpm_publish_time":1517930020025,"dist-tags":{"latest":"1.1.5"}}