All Projects → fenekku → moustachu

fenekku / moustachu

Licence: other
Mustache templating for Nim

Programming Languages

nim
578 projects

Projects that are alternatives of or similar to moustachu

Handlebars.net
A real .NET Handlebars engine
Stars: ✭ 723 (+1146.55%)
Mutual labels:  template-engine, mustache
Mikado
Mikado is the webs fastest template library for building user interfaces.
Stars: ✭ 323 (+456.9%)
Mutual labels:  template-engine, mustache
Grmustache.swift
Flexible Mustache templates for Swift
Stars: ✭ 538 (+827.59%)
Mutual labels:  template-engine, mustache
Api2html
Using the data from your API, generate the HTML on the fly! Server-side rendering of the mustache templates
Stars: ✭ 97 (+67.24%)
Mutual labels:  template-engine, mustache
Bbmustache
Binary pattern match Based Mustache template engine for Erlang/OTP.
Stars: ✭ 141 (+143.1%)
Mutual labels:  template-engine, mustache
django-mustache
Mustache (Pystache) template engine for Django 1.8 and newer, with support for Django context processors. Designed to support offline-capable web apps via progressive enhancement.
Stars: ✭ 20 (-65.52%)
Mutual labels:  template-engine, mustache
Spring Boot Email Tools
A set of services and tools for sending emails in a Spring Boot 1.5.x application using a Template Engine
Stars: ✭ 164 (+182.76%)
Mutual labels:  template-engine, mustache
morestachio
Lightweight, powerful, flavorful, template engine.
Stars: ✭ 45 (-22.41%)
Mutual labels:  template-engine, mustache
colon
Minimal, concise and blazing fast template engine.
Stars: ✭ 43 (-25.86%)
Mutual labels:  template-engine
shaven
DOM building utility & Template engine based on JsonML + syntax sugar
Stars: ✭ 66 (+13.79%)
Mutual labels:  template-engine
typed-html
TypeSafe HTML templates using TypeScript. No need to learn a template library.
Stars: ✭ 92 (+58.62%)
Mutual labels:  template-engine
karkas
A tiny template engine based on TypeScript
Stars: ✭ 14 (-75.86%)
Mutual labels:  template-engine
stache
A Mustache template compiler.
Stars: ✭ 16 (-72.41%)
Mutual labels:  mustache
raku-Template-Mustache
Raku library for the Mustache template format
Stars: ✭ 16 (-72.41%)
Mutual labels:  mustache
docxmustache
laravel 8.x docx template manipulation class, based on mustache templating language
Stars: ✭ 34 (-41.38%)
Mutual labels:  mustache
nunjucks-loader
Webpack loader for Nunjucks templates
Stars: ✭ 20 (-65.52%)
Mutual labels:  template-engine
gktemplate
GKTemplate - 采用Go开发的DedeCMS模板解析器
Stars: ✭ 32 (-44.83%)
Mutual labels:  template-engine
kotlin-html
A library to generate HTML in Kotlin.
Stars: ✭ 23 (-60.34%)
Mutual labels:  template-engine
idris-tmustache
Total Logic-Less Templating Library
Stars: ✭ 12 (-79.31%)
Mutual labels:  template-engine
korte
Kotlin cORoutines Template Engine for Multiplatform Kotlin
Stars: ✭ 69 (+18.97%)
Mutual labels:  template-engine

Moustachu

Build Status

Moustachu is a(N im)plementation of Mustache (get it?). Mustache is "logic-less templating".

Usage

In code

import moustachu


var tmplate = """Hello {{name}}
You have just won {{value}} dollars!
{{#in_ca}}
Well, {{taxed_value}} dollars, after taxes.
{{/in_ca}}"""

var c : Context = newContext()
c["name"] = "Chris"
c["value"] = 10000
c["taxed_value"] = 10000 - (10000 * 0.4)
c["in_ca"] = true

echo render(tmplate, c)

For other mustache examples look at the specs directory. For other moustachu-specific examples see the tests folder.

For the formal description of the mustache format, please visit mustache(5). Ignore the sections on "lambdas" and "set delimeters".

Not mentioned in the formal description (but mentioned in the spec code), the spec also supports using a dot . as an "implicit iterator" for arrays containing unnamed items. For example, a sequence of strings or integers would use an implicit iterator:

import moustachu

var c : Context = newContext()
c["zoo_name"] = "Anytown"
c["animals"] = @["lions", "tigers", "bears"]


var tmplate = """Animals at the {{zoo_name}} Zoo:

{{#animals}}
* {{.}}
{{/animals}}"""

echo render(tmplate, c)

On the command line

$ moustachu <context>.json <template>.moustache
$ moustachu <context>.json <template>.moustache --file=<output>

The first version will print to stdout and the second will generate a file.

Compliance

Moustachu supports the specs found in its specs directory:

  • comments
  • interpolation
  • inverted
  • partials
  • sections

Installation

The recommended way to install moustachu is through nimble:

Install nimble. Then do:

$ nimble install moustachu

This will install the latest tagged version of moustachu.

The moustachu package includes the moustachu binary to use on the command line and the moustachu library to use in your code.

Design

  • Make the interfaces with the data structures as dynamic-like as possible
  • No lambdas, nor set delimiters. At least for now. Let's keep it simple please.
  • Test in context. Tests are run on the installed package because that is what people get.

Develop and Test

Get the source code:

$ git clone https://github.com/fenekku/moustachu.git
$ cd moustachu
# make your changes ...
# test
$ nimble tests
# run benchmarks
$ nimble benchmarks

This will test against the selected specs copied from mustache/spec

TODO

  • Use to see what else to do/fix
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].