Skip to content

About

Mustache templates in Elm

Resources

Stars

1 star

Watchers

0 watching

Forks

 
 

Latest commit

 

History

32 Commits

Folders and files

Repository files navigation

Elm-Mustache

An Elm library for Mustache templates.

Currently, this library support attempts limited support for version 1.4.3 of the Mustache Spec.

Supported

  • Interpolation of string variables (e.g. {{ name }})
  • Boolean sections and inverted sections (e.g. {{# show }} or {{^ hide }})
  • HTML encoding (e.g. {{ characters }} renders Abbot & Costello)
  • HTML escaping (e.g. {{{ characters }}} or {{& characters }})
  • Comments (e.g. {{! comment }})

Not Supported

  • Partials
  • Lambdas
  • Blocks
  • Set Delimiter (e.g. {{=<% %>=}})
  • Implicit Iterator (e.g. {{.}})
  • Whitespace handling for standalone lines
  • Arbitrary data types

Usage

import Mustache


template : String
template =
  "Hi, my name is {{ name }}.{{# show }} Show me!{{/ show }}"

evaluatedTemplate : Maybe String
evaluatedTemplate =
  Mustache.render
    [ Mustache.Variable "name" "D'Angelo"
    , Mustache.Section "show" True
    ]
    template
    
evaluatedTemplate --> Just "Hi, my name is D&#39;Angelo. Show me!"

About

Mustache templates in Elm

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages