{"id":32187621,"url":"https://github.com/fhd/clostache","last_synced_at":"2025-10-22T00:10:32.566Z","repository":{"id":1120440,"uuid":"992392","full_name":"fhd/clostache","owner":"fhd","description":"{{ mustache }} for Clojure","archived":false,"fork":false,"pushed_at":"2022-03-10T10:11:45.000Z","size":196,"stargazers_count":323,"open_issues_count":22,"forks_count":61,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-10-22T00:10:08.133Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fhd.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-10-16T12:21:24.000Z","updated_at":"2025-07-31T09:15:40.000Z","dependencies_parsed_at":"2022-08-04T08:30:26.724Z","dependency_job_id":null,"html_url":"https://github.com/fhd/clostache","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/fhd/clostache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhd%2Fclostache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhd%2Fclostache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhd%2Fclostache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhd%2Fclostache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fhd","download_url":"https://codeload.github.com/fhd/clostache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhd%2Fclostache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280354948,"owners_count":26316574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-22T00:07:53.511Z","updated_at":"2025-10-22T00:10:32.560Z","avatar_url":"https://github.com/fhd.png","language":"Clojure","funding_links":[],"categories":["HTML Manipulation"],"sub_categories":[],"readme":"Clostache\n=========\n\n[{{ mustache }}](http://mustache.github.com) for Clojure.\n\nCompliant with the [Mustache spec](http://github.com/mustache/spec)\nsince version 1.0. Supporting lambdas since version 1.1.\n\nWorks with Clojure 1.5 since version 1.5. If you want to use Clostache in\nClojure 1.3 or 1.4 projects, use version 1.4. In Clojure 1.2 projects, use\nversion 1.1.\n\n[![Build Status](https://secure.travis-ci.org/fhd/clostache.png?branch=master)](http://travis-ci.org/fhd/clostache)\n\nUsage\n-----\n\nThe easiest way to use Clostache in your project is via\n[Clojars](http://clojars.org/de.ubercode.clostache/clostache).\n\nLeiningen:\n\n```clj\n[de.ubercode.clostache/clostache \"1.4.0\"]\n```\n\nMaven:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ede.ubercode.clostache\u003c/groupId\u003e\n  \u003cartifactId\u003eclostache\u003c/artifactId\u003e\n  \u003cversion\u003e1.4.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nTo install it via [cljr](https://github.com/liebke/cljr), run:\n\n```\ncljr install de.ubercode.clostache/clostache\n```\n\nThis is how you use Clostache:\n\n```clj\n(use 'clostache.parser)\n(render \"Hello, {{name}}!\" {:name \"Felix\"})\n```\n\nYou can render a resource from the classpath like this:\n\n```clj\n(use 'clostache.parser)\n(render-resource \"templates/hello.mustache\" {:name \"Michael\"})\n```\n\nEach function supports an optional third argument, containing partials (see below).\n\nExamples\n--------\n\n### Variable replacement ###\n\nVariables are tags enclosed by two curly brackets (*mustaches*) and\nwill be replaced with the respective data.\n\nTemplate:\n\n```mustache\nHello, {{person}}!\n```\n\nData:\n\n```clj\n{:person \"World\"}\n```\n\nOutput:\n\n```\nHello, World!\n```\n\n### Escaped output ###\n\nThe following characters will be replaced with HTML entities:\n`\u0026\"\u003c\u003e`. Tags that use three curly brackets or start with `{{\u0026` will\nnot be escaped.\n\nTemplate:\n\n```mustache\nEscaped: {{html}}\nUnescaped: {{{html}}}\nUnescaped: {{\u0026html}}\n```\n\nData:\n\n```clj\n{:html \"\u003ch1\u003eHello, World!\u003c/h1\u003e\"}\n```\n\nOutput:\n\n```html\nEscaped: \u0026lt;h1\u0026gt;Hello, World!\u0026lt;/h1\u0026gt;\nUnescaped: \u003ch1\u003eHello, World!\u003c/h1\u003e\nUnescaped: \u003ch1\u003eHello, World!\u003c/h1\u003e\n```\n\n### Sections ###\n\nSections start with a tag beginning with `{{#` and end with one\nbeginning with `{{/`. Their content is only rendered if the data is\neither the boolean value `true`, a value or a non-empty list.\n\nTemplate:\n\n```mustache\n{{#greet}}Hello, World!{{/greet}}\n```\n\nData:\n\n```clj\n{:greet true}\n```\n\nOutput:\n\n```\nHello, World!\n```\n\nIn case of a list, the section's content is rendered for each element,\nand it can contain tags refering to the elements.\n\nTemplate:\n\n```mustache\n\u003cul\u003e\n{{#people}}\n    \u003cli\u003e{{name}}\u003c/li\u003e\n{{/people}}\n\u003c/ul\u003e\n```\n\nData:\n\n```clj\n{:people [{:name \"Felix\"} {:name \"Jenny\"}]}\n```\n\nOutput:\n\n```html\n\u003cul\u003e\n    \u003cli\u003eFelix\u003c/li\u003e\n    \u003cli\u003eJenny\u003c/li\u003e\n\u003c/ul\u003e\n```\n\nFor single values, the section is rendered exactly once.\n\nTemplate:\n\n```mustache\n{{#greeting}}{{text}}!{{/greeting}}\n```\n\nData:\n\n```clj\n{:greeting {:text \"Hello, World\"}}\n```\n\nOutput:\n\n```\nHello, World!\n```\n\n### Inverted sections ###\n\nInverted sections start with a tag beginning with `{{^` and end with one\nbeginning with `{{/`. Their content is only rendered if the data is\neither the boolean value `false` or an empty list.\n\nTemplate:\n\n```mustache\n{{^ignore}}Hello, World!{{/ignore}}\n```\n\nData:\n\n```clj\n{:ignore false}\n```\n\nOutput:\n\n```\nHello, World!\n```\n\n### Comments ###\n\nComments are tags that begin with `{{!`. They will not be rendered.\n\nTemplate:\n\n```mustache\n\u003ch2\u003eFelix' section\u003ch2\u003e\n{{! Look ma, I've written a section }}\n```\n\nOutput:\n\n```html\n\u003ch2\u003eFelix' section\u003c/h2\u003e\n```\n\n### Dotted names ###\n\nDotted names are a shorter and more convenient way of accessing nested\nvariables or sections.\n\nTemplate:\n\n```mustache\n{{greeting.text}}\n```\n\nData:\n\n```clj\n{:greeting {:text \"Hello, World\"}}\n```\n\nOutput:\n\n```\nHello, World\n```\n\n### Implicit iterators ###\n\nImplicit iterators allow you to iterate over a one dimensional list of\nelements.\n\nTemplate:\n\n```mustache\n\u003cul\u003e\n{{#names}}\n    \u003cli\u003e{{.}}\u003c/li\u003e\n{{/names}}\n\u003c/ul\u003e\n```\n\nData:\n\n```clj\n{:names [\"Felix\" \"Jenny\"]}\n```\n\nOutput:\n\n```html\n\u003cul\u003e\n    \u003cli\u003eFelix\u003c/li\u003e\n    \u003cli\u003eJenny\u003c/li\u003e\n\u003c/ul\u003e\n```\n\n### Partials ###\n\nPartials allow you to include other templates (e.g. from separate files).\n\nTemplate:\n\n```mustache\nHello{{\u003enames}}!\n```\n\nData:\n\n```clj\n{:people [{:name \"Felix\"} {:name \"Jenny\"}]}\n```\n\nPartials:\n\n```mustache\n{:names \"{{#people}}, {{name}}{{/people}}\"}\n```\n\nOutput:\n\n```\nHello, Felix, Jenny!\n```\n\n### Set delimiters ###\n\nYou don't have to use mustaches, you can change the delimiters to\nanything you like.\n\nTemplate:\n\n```mustache\n{{=\u003c% %\u003e=}}\nHello, \u003c%name%\u003e!\n```\n\nData:\n\n```clj\n{:name \"Felix\"}\n```\n\nOutput:\n\n```\nHello, Felix!\n```\n\n### Lambdas ###\n\nYou can also call functions from templates.\n\nTemplate:\n\n```mustache\n{{hello}}\n{{#greet}}Felix{{/greet}}\n```\n\nData:\n\n```clj\n{:hello \"Hello, World!\"}\n{:greet #(str \"Hello, \" %)}\n```\n\n\nOutput:\n\n```\nHello, World!\nHello, Felix!\n```  \n\nFunctions can also render the text given to them if they need to do something more complicated.  \n\nTemplate:\n\n```mustache\n\"{{#people}}Hi {{#upper}}{{name}}{{/upper}}{{/people}}\"\n```\n\nData:\n```clj\n{:people [{:name \"Felix\"}] \n :upper (fn [text] \n          (fn [render-fn] \n            (clojure.string/upper-case (render-fn text))))}\n```\n\nOutput:  \n\n```\nHello FELIX\n```\n\nDevelopment\n-----------\n\nMake sure you have\n[Leiningen 2](https://github.com/technomancy/leiningen/wiki/Upgrading)\ninstalled.\n\nTo run the spec tests, fetch them like this:\n\n```\ngit submodule update --init\n```\n\nAnd run them against all supported Clojure versions:\n\n```\nlein all test\n```\n\nLicense\n-------\n\nCopyright (C) 2014 Felix H. Dahlke\n\nThis library is free software; you can redistribute it and/or modify\nit under the terms of the GNU Lesser General Public License as\npublished by the Free Software Foundation; either version 2.1 of the\nLicense, or (at your option) any later version.\n\nThis library is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with this library; see the file COPYING. If not, write\nto the Free Software Foundation, Inc., 51 Franklin Street, Fifth\nFloor, Boston, MA 02110-1301 USA\n\nContributors\n------------\n\n* [Rory Geoghegan](https://github.com/rgeoghegan)\n* [Santtu Lintervo](https://github.com/santervo)\n* [Pierre-Alexandre St-Jean](https://github.com/pastjean)\n* [Michael Klishin](https://github.com/michaelklishin)\n* [Stan Rozenraukh](https://github.com/stanistan)\n* [Tero Parviainen](https://github.com/teropa)\n* [Masashi Iizuka](https://github.com/liquidz)\n* [Julian Birch](https://github.com/JulianBirch)\n* [Ryan Cole](https://github.com/ryancole)\n* [Simon Lawrence](https://github.com/simonl2002)\n* [Darrell Hamilton](https://github.com/zeroem)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffhd%2Fclostache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffhd%2Fclostache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffhd%2Fclostache/lists"}