Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/avdgaag/mustache
Logic-less templates in Gleam
https://github.com/avdgaag/mustache
Last synced: 19 days ago
JSON representation
Logic-less templates in Gleam
- Host: GitHub
- URL: https://github.com/avdgaag/mustache
- Owner: avdgaag
- Created: 2023-12-16T21:15:11.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-20T19:44:49.000Z (about 1 year ago)
- Last Synced: 2024-04-15T15:54:46.494Z (9 months ago)
- Language: Gleam
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mustache
[![Package Version](https://img.shields.io/hexpm/v/mustache)](https://hex.pm/packages/mustache)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/mustache/)Mustache is an implemenation of [mustache](https://mustache.github.io) in Gleam.
It provides logic-less templates that can be used for HTML or other output
formats.## Templates
Templates are strings with special tags that will be processed by Mustache. For
a full reference of available syntax, see [the manual](https://mustache.github.io/mustache.5.html).
This library implements the following tags:* `{{ escaped_variables }}`
* `{{ nested.variables }}`
* `{{{ unescaped_variables }}}`
* `{{! comments }}`
* `{{# sections }}...{{/ sections }}`
* `{{^ inverted_sections }}...{{/ inverted_sections }}`## Context
The context provides the data to be interpolated into the template. You can construct
special `Context` valuesing using `mustache/context`.## Quick start
```sh
gleam run # Run the project
gleam test # Run the tests
gleam shell # Run an Erlang shell
```Use in your Gleam program:
``` gleam
import mustache.{render}
import mustache/context.{dict, string}pub fn example() {
"hello, {{ name }}"
|> render(dict([#("name", string("world"))]))
}
```## Installation
If available on Hex this package can be added to your Gleam project:
```sh
gleam add mustache
```and its documentation can be found at .