{"_id":"tempreites","_rev":"36-74b57b727032bb60acbbaf9fc4ab1f03","name":"tempreites","description":"Semantic string templates direto da roça for the browser and server.","dist-tags":{"latest":"0.1.8"},"versions":{"0.0.1":{"name":"tempreites","version":"0.0.1","description":"Semantic string templates direto da roça for the browser and server.","keywords":["templates","templating","unobtrusive"],"author":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"maintainers":[{"name":"fiatjaf","email":"fiatjaf@gmail.com"}],"licenses":[{"type":"MIT"}],"repositories":[{"type":"git","url":"git://github.com/fiatjaf/tempreites.git"}],"scripts":{"test":"xdg-open tests/test.html"},"main":"./dist/tempreites.js","repository":"[Circular ~.repositories.0]","bugs":{"url":"https://github.com/fiatjaf/tempreites/issues"},"_id":"tempreites@0.0.1","dist":{"shasum":"a755d48a01d1522fe0ba73401d88e630a63c93b6","tarball":"https://registry.npmjs.org/tempreites/-/tempreites-0.0.1.tgz","integrity":"sha512-0712ukoE4Ea6GI0EMAF9+NeIF5Nf1M4F4G5gd/J5CxIkfJuC2vYrff95FAU9GHjkmow9XOPvMDkHvTP5ikifAw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCgwhrI6WlpfI9716dFPVvsH4pyUJlt83PrrYUsXhKIQgIgQsCDWkeGRCL2uZBSMw//4KCNxf2UHgLX1xzAP2fllCw="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"directories":{}},"0.0.2":{"name":"tempreites","version":"0.0.2","description":"Semantic string templates direto da roça for the browser and server.","keywords":["templates","templating","unobtrusive"],"author":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"maintainers":[{"name":"fiatjaf","email":"fiatjaf@gmail.com"}],"licenses":[{"type":"MIT"}],"repositories":[{"type":"git","url":"git://github.com/fiatjaf/tempreites.git"}],"scripts":{"test":"xdg-open tests/test.html"},"main":"./dist/tempreites.js","repository":"[Circular]","bugs":{"url":"https://github.com/fiatjaf/tempreites/issues"},"_id":"tempreites@0.0.2","dist":{"shasum":"357117c2ca0af9d190a47a71163c7bba1f76c8df","tarball":"https://registry.npmjs.org/tempreites/-/tempreites-0.0.2.tgz","integrity":"sha512-00g++ZJqmp/Mbllcg82kgat4LYvXnmvSmZ+lVAPdgHZ5DoGPzXsadPbhrO4CxoGK/ZtsJ0TF1juqREfBGk3dQQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDZLsXb3n65W9jNj3kG8FRWDnvp+7KSu5Pafv3A3j+nYQIgKPLq3qTvNKUJuVRJOqhkn4SteQrtkh6qWB0hrqBsnAE="}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"fiatjaf","email":"fiatjaf@yahoo.com.br"},"directories":{}},"0.1.0":{"name":"tempreites","version":"0.1.0","description":"Semantic string templates direto da roça for the browser and server.","keywords":["templates","templating","unobtrusive"],"author":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"maintainers":[{"name":"fiatjaf","email":"fiatjaf@gmail.com"}],"licenses":[{"type":"MIT"}],"repositories":[{"type":"git","url":"git://github.com/fiatjaf/tempreites.git"}],"scripts":{"test":"xdg-open tests/test.html"},"main":"./dist/tempreites.js","repository":"[Circular]","bugs":{"url":"https://github.com/fiatjaf/tempreites/issues"},"_id":"tempreites@0.1.0","dist":{"shasum":"43b255fa7d52490c5e59ef5bcac9ae24c8485450","tarball":"https://registry.npmjs.org/tempreites/-/tempreites-0.1.0.tgz","integrity":"sha512-S7ZxnlH/baN6sWqkUQnEqHfV27JWne0eaOM+Fv+97NSPMeMsAgFv6tScvyf8eF5U0XE1zOf28NWnLgWilBfSVA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC/3CmkCWPlC5t0Glz6NZPjPVd8l9OKS0lnXpK6JRVpNQIgecwvySUIEZ8ErvJRwjzDPRixFc3HR9IXluUIDkokfRU="}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"fiatjaf","email":"fiatjaf@yahoo.com.br"},"directories":{}},"0.1.2":{"name":"tempreites","version":"0.1.2","description":"Semantic string templates direto da roça for the browser and server.","keywords":["templates","templating","unobtrusive"],"author":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"maintainers":[{"name":"fiatjaf","email":"fiatjaf@gmail.com"}],"licenses":[{"type":"MIT"}],"repositories":[{"type":"git","url":"git://github.com/fiatjaf/tempreites.git"}],"scripts":{"test":"xdg-open tests/test.html"},"main":"./dist/tempreites.js","repository":"[Circular ~.repositories.0]","bugs":{"url":"https://github.com/fiatjaf/tempreites/issues"},"_id":"tempreites@0.1.2","dist":{"shasum":"0f58ebdb755949be5fa65cbf8a3350a039687a38","tarball":"https://registry.npmjs.org/tempreites/-/tempreites-0.1.2.tgz","integrity":"sha512-C/6fBkRplgvO2CDmOnqp1vtpgoqTusWkdQ3fquNQ1WjRXBSnNwUqTqOVF2ooOsJmGcF6cmd6eQkhD2fUmT+PKw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICaBGy+jbXLQhuW1HLPWOsTZYpcyRqxQ/coy9fdN5dy2AiBHc26mE1q+V4dfQaZ/AnuLANh+Bm8y/oOJUFefdZwAqg=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"directories":{}},"0.1.7":{"name":"tempreites","version":"0.1.7","description":"Semantic string templates direto da roça for the browser and server.","keywords":["templates","templating","unobtrusive"],"author":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"maintainers":[{"name":"fiatjaf","email":"fiatjaf@gmail.com"}],"licenses":[{"type":"MIT"}],"repository":{"type":"git","url":"git://github.com/fiatjaf/tempreites.git"},"scripts":{"test":"python -m SimpleHTTPServer && xdg-open http://localhost:8000/tests","build":"grunt"},"main":"./dist/tempreites.js","devDependencies":{"grunt":"~0.4.2","grunt-contrib-uglify":"~0.2.2"},"bugs":{"url":"https://github.com/fiatjaf/tempreites/issues"},"_id":"tempreites@0.1.7","dist":{"shasum":"cd4d3d6100c1985b7b15648ff9a57859b5ecdcf8","tarball":"https://registry.npmjs.org/tempreites/-/tempreites-0.1.7.tgz","integrity":"sha512-sYD98l9J+kkC0S+Z8ODqBfqwd/zmZ8BGUD7CQdJ5AiRYt7w5ISHjnFRkPyM9wugkMptxtG7b4M6DU5iHTIutUA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFpB1mxTM/n8gIihazpYKIyLLNY26y5BUU6s9e4mNTudAiEAlS8nX9xPEavyEed0/Xx+iLj3tIGEeEOyUNnch7+YMOA="}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"fiatjaf","email":"fiatjaf@yahoo.com.br"}},"0.1.8":{"name":"tempreites","version":"0.1.8","description":"Semantic string templates direto da roça for the browser and server.","keywords":["templates","templating","unobtrusive"],"author":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"maintainers":[{"name":"fiatjaf","email":"fiatjaf@gmail.com"}],"licenses":[{"type":"MIT"}],"repository":{"type":"git","url":"git://github.com/fiatjaf/tempreites.git"},"scripts":{"test":"python -m SimpleHTTPServer && xdg-open http://localhost:8000/tests","build":"grunt"},"main":"./src/tempreites.js","devDependencies":{"grunt":"~0.4.2","grunt-contrib-uglify":"~0.2.2"},"gitHead":"de51e1cee2198b8732eea96ba8dfafe43923ef5c","bugs":{"url":"https://github.com/fiatjaf/tempreites/issues"},"homepage":"https://github.com/fiatjaf/tempreites","_id":"tempreites@0.1.8","_shasum":"8bea92c2571277328fd36df0e9af6744cbbc9329","_from":".","_npmVersion":"2.7.4","_nodeVersion":"0.12.2","_npmUser":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"dist":{"shasum":"8bea92c2571277328fd36df0e9af6744cbbc9329","tarball":"https://registry.npmjs.org/tempreites/-/tempreites-0.1.8.tgz","integrity":"sha512-BIwHfuJAHbdMzGkqd+FLWDWAs8HYD7HOJYnTTBSjiHThNJ504dYeBoIId4QTUXOOYNxMlcBYrwE0thT64Tznww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC/E4XBiC3V7QTUkZsJdUGbRjpLAXfiPIfA8e4YxVoRkgIhANXbOjx908n6VcnNJtgWeByR7SR7aOHaJ/pgkMBix0rX"}]}}},"readme":"### [DEMO](http://jsfiddle.net/fiatjaf/mSEZ6/)\n### [Comparison with Mustache](http://jsperf.com/tempreites-vs-mustache/4)\n\n# Tempreites\n\nCrude string templating without any syntax, just semantic HTML.\n\n## Usage\n\nGet this as a string, \n\n```html\n<div id=\"austrianeconomics\">\n  <h1 class=\"title\"></h1>\n  <ul id=\"theories\">\n    <li>\n      <span class=\"author\"></span>\n      <span>\n        <a class=\"theory\" \n           data-bind-here=\"href\"\n           data-bind-there=\"url\">\n        </a>\n      </span>\n    </li>\n  </ul>\n</div>\n```\n\nattach data to it,\n\n```javascript\nvar data = {\n  title: 'Austrian economists and their theories',\n  theories: [\n    { author: 'Menger', theory: 'Subjective value', url: '/subj' },\n    { author: 'Hayek', theory: 'Austrian Business Cycle Theory', url: '/abct' },\n    { author: 'Kirzner', theory: 'Sheer ignorance and entrepreneurship', url: '/entre' },\n  ]\n}\n\ntempreites.render(template, data)\n```\n\nget this back:\n\n```html\n<div id=\"austrianeconomics\">\n  <h1 class=\"title\"></h1>\n  <ul id=\"theories\">\n    <li>\n      <span class=\"author\">Menger</span>\n      <span>\n        <a class=\"theory\" \n           data-bind-here=\"href\"\n           data-bind-there=\"url\"\n           href=\"/subj\">\n          Subjective value\n        </a>\n      </span>\n    </li>\n    <li>\n      <span class=\"author\">Hayek</span>\n      <span>\n        <a class=\"theory\" \n           data-bind-here=\"href\"\n           data-bind-there=\"url\"\n           href=\"/abct\">\n          Austrian Business Cycle Theory\n        </a>\n      </span>\n    </li>\n    <li>\n      <span class=\"author\">Kirzner</span>\n      <span>\n        <a class=\"theory\" \n           data-bind-here=\"href\"\n           data-bind-there=\"url\"\n           href=\"/entre\">\n          Sheer ignorance and entrepreneurship\n        </a>\n      </span>\n    </li>\n  </ul>\n</div>\n```\n\n## Features\n\n* __Semantic data binding__ - No need for <%=foo%> or {{foo}} assignments\n* __Collection rendering__ - No need for hand-written loops\n* __Valid HTML templates__ - Write templates as a part of the HTML, in plain HTML\n* __View logic in JavaScript__ - No crippled micro-template language, just plain JavaScript functions\n\n## TODOs:\n\n* _Basic optmization_\n* _Read some `data-` attr to see in which element arrays of data will duplicate_\n\n## Installation\n\n```\nnpm install tempreites\n```\n\nOr download the [file](https://raw.github.com/fiatjaf/tempreites/master/dist/tempreites.js) and include it anywhere.\n\n---\n\n## Documentation\n\nConsidering a `data` object like this:\n```javascript\nvar data = {\n  name: 'Miyamoto',\n  link: '/miyamoto',\n  completeName: {\n    first: 'Shigeru'\n    last: 'Miyamoto'\n  },\n  sons: [{ name: 'Mario', show: true }, { name: 'Luigi', show: false }]\n  show: true\n}\nTempreites.render(template, data)\n```\n\n#### Binding values\n\nUse a `class` or an `id` at the target element with the value of the key in your `data` object.\n```html\n<h1 class=\"name\"></h1>\n```\n\n#### Nested objects\n\nUse a `class` or an `id` at some element with the value of the parent key in your `data` object, then use a `class` or `id` with the child key anywhere inside the parent element.\n```html\n<div id=\"name\">\n  <h1>\n    <span class=\"last\"></span>, <span class=\"first\"></span></h1>\n  </h1>\n</div>\n```\n\n#### Nested lists\n\nUse a `class` or an `id` at the element immediattely before the element you want to be repeated with the list values, then use a `class` or `id` with the child key anywhere inside it.\n```html\n<div id=\"sons\">\n  <p class=\"name\"></p>\n</div>\n```\n\n#### Binding values to attributes\n\nUse the `data-bind` attribute with the special syntax \"javascriptObjectAttrName - > htmlElementAttrNameToBindTo\". If you want to bind to more than one attr, write the other bindings at the same `data-bind`, separated by a `|`:\n```html\n<header>\n  <h1 id=\"name\"></h1>\n  <img data-bind=\"url -> src | name -> alt\">\n</header>\n```\n\n#### Conditional showing of elements\n\nUse the `data-show-if` attr naming a key at the `data` object which will be tested for deciding if the element\nwill be shown or not.\n```html\n<div id=\"miyamoto\" data-show-if=\"show\">\n  <ul class=\"sons\">\n    <li class=\"name\" data-show-if=\"show\"></li>\n  </ul>\n</div>\n```\n\n#### Pre-compiling templates\n\nCall the `compile` function to get a pre-compiled template to which you can just pass the data later.\n```javascript\nvar tpr = Tempreites.compile('<div class=\"u\"></div>')\ntpr.render({u: 'a'})\ntpr.render({u: 'b'})\n```\n\n---\n\nInspired by [Plates](https://github.com/flatiron/plates) and [Transparency](https://github.com/leonidas/transparency/), but simplified and more useful.\n\n---\n\nWritten with regular expressions, como se fazia antigamente lá na roça.\n","maintainers":[{"name":"fiatjaf","email":"fiatjaf@gmail.com"}],"time":{"modified":"2022-06-27T04:43:49.459Z","created":"2013-12-12T17:02:55.100Z","0.0.1":"2013-12-12T17:03:00.099Z","0.0.2":"2013-12-13T19:53:42.074Z","0.1.0":"2013-12-16T00:25:34.045Z","0.1.2":"2013-12-24T03:09:33.985Z","0.1.5":"2014-01-24T15:45:06.564Z","0.1.6":"2014-01-28T16:18:41.677Z","0.1.7":"2014-01-28T16:22:56.394Z","0.1.8":"2015-05-25T21:49:59.431Z"},"author":{"name":"fiatjaf","email":"fiatjaf@gmail.com"},"repository":{"type":"git","url":"git://github.com/fiatjaf/tempreites.git"},"readmeFilename":"README.md","homepage":"https://github.com/fiatjaf/tempreites","keywords":["templates","templating","unobtrusive"],"bugs":{"url":"https://github.com/fiatjaf/tempreites/issues"}}