BSD-3-Clause licensed by Justus Adam
Maintained by [email protected]
This version can be pinned in stack with:mustache-2.1.2@sha256:e3d6c5526e26c04f3f7b8c0df2c817eae10f7e42a81d26b933173aa355ef775c,3885

mustache Travis Status Hackage Join the chat at https://gitter.im/JustusAdam/mustache

Haskell implementation of mustache templates.

Implements the official specs version 1.1.3

Motivation

The old Haskell implementation of mustache templates hastache seemed pretty abandoned to me. This implementation aims to be much easier to use and (fingers crossed) better maintained.

Since it is so easy to use and requires but a few files of code, I’ve also written a small executable that compiles and renders mustache templates with data input from json or yaml files.

Usage

Library

Please refer to the documentation on hackage.

Executable haskell-mustache

$ haskell-mustache --help
Simple mustache template substitution

arguments [OPTIONS] TEMPLATE [DATA-FILES]

Common flags:
  -t --templatedirs[=DIRECTORY]  The directory in which to search for the
                                 templates
  -? --help                      Display help message
  -V --version                   Print version information

Current implementation substitutes the TEMPLATE once with each DATA-FILE

Roadmap

  • [x] String parser for mustache templates
  • [x] Template substitution
  • [x] Standalone executable
  • [x] Support for ‘set delimiter’
  • [x] More efficiency using Text rather than String
  • [x] More efficient Text parsing
  • [x] Test coverage provided via the official specs
  • [x] Haddock documentation
  • [ ] More instances for ToMustache typeclass

Changes

Mustache library changelog

v2.1.2

  • Fixed template cahce again, as the spec requires access to the previous cache in partials as well

v2.1.1

  • Fixed an error where the substitution of partials would not use the template cache of the new partial

v2.1

  • Added API preserving checked substitution with ‘checkedSubstitute’ and ‘checkedSubstituteValue’
  • Better and more ToMustache instances. No longer are all sequences of characters serialised as strings

v2.0

  • Added QuasiQuotes and template Haskell functions for compile time template embedding.

v1.0

  • Stabilised API’s

v0.5.1.0rc-7

  • Removed dependency tagsoup
  • Added ToMustache instances for some numbers

v0.5.0.0rc-6

  • Removed any dependency on ghc 7.10-type OverlappingInstances
  • Resolved String/List overlapping instances

v0.4.0.1rc-5

  • Added a necessary OVERLAPPABLE pragma

v0.4.0.0rc-4 (current stable version)

  • Removed conversion and conversion-text dependency.
  • Subsequently removed any dependency on overlapping instances
  • Readded support for ghc version 7.8
  • Removed Char -> Value instance of ToMustache (because of overlap)
  • Renamed AST

v0.3.1.0rc-3

  • Added infix precedence to conversion operators
  • Added INLINEABLE pragma to conversion functions

v0.3.0.1rc-2

Dropped GHC 7.8 support in favor of efficient and easy data conversion.

v0.3.0.0rc-1

  • improved documentation
  • fixed a bug with scope
  • small interface changes