Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/liquidz/mint

A proof of concept for simple template engine using threading macros
https://github.com/liquidz/mint

babashka clojure clojurescript nbb template-engine

Last synced: 8 days ago
JSON representation

A proof of concept for simple template engine using threading macros

Awesome Lists containing this project

README

        

= Mint

image:https://github.com/liquidz/mint/workflows/test/badge.svg["GitHub Actions for test workflow", link="https://github.com/liquidz/mint/actions?query=workflow%3Atest"]
image:https://github.com/liquidz/mint/workflows/lint/badge.svg["GitHub Actions for lint workflow", link="https://github.com/liquidz/mint/actions?query=workflow%3Alint"]
image:https://img.shields.io/badge/babashka-compatible-brightgreen["Babashka", link="https://github.com/babashka/babashka"]
image:https://img.shields.io/badge/nbb-compatible-brightgreen["nbb", link="https://github.com/babashka/nbb"]

A simple single-line template engine like Mustache and Clojure.

== Concept

* Similar mustache, but Clojure like style
** `{{foo}}`
** `{{-> v f (g "foo")}}`
** `{{->> v f (g "foo")}}`
* No dependencies

== Usage

image:https://img.shields.io/clojars/v/com.github.liquidz/mint["Clojars Project", link="https://clojars.org/com.github.liquidz/mint"]

[source,clojure]
----
(require '[mint.core :as mint])
;; => nil

(mint/render "{{-> name greet}}!"
{:name "world" :greet #(str "Hello " %)})
;; => "Hello world!"

(mint/render "{{->> name (str \"Hello \")}}!"
{:name "world" :str str})
;; => "Hello world!"
----

== Supported functions

* `->`, `->>`, `some->`, `some->>`
* `when`

== License

Copyright © 2022-2024 https://scrapbox.io/uochan/uochan[Masashi Iizuka]

This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0.

This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the Eclipse
Public License, v. 2.0 are satisfied: GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or (at your
option) any later version, with the GNU Classpath Exception which is available
at https://www.gnu.org/software/classpath/license.html.