Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

mustache implementation in Lua

This is a simple implementation of Mustache in Lua.

See [http://mustache.github.com/mustache.5.html] for details on mustache.

How to use

Mostacho does not use Lua modules but closures. You can use Mostacho like so:

local mostacho = require 'mostacho'

local template = [[ This is {{name}}. ]]
local model = { name = 'Mostacho' }

local rendered, err = mostacho.render(model, template)

if rendered == nil then
  error(err)
else
  print(rendered)
end

Goals

  • to be fast.
  • and to be fully compatible with mustache.
  • no external dependencies.
  • maybe I want to compile templates in the future (to avoid parsing them again and again).

Non goals

The mustache processor won't be implemented in the near term.

Features

Errors in templates (unclosed sections, missing end tags) are reported with line numbers.

Status

I'm working on it as a hobby project, no hurries.

All tags from mustache are implemented. This includes:

  • '{{'
  • '{{{'
  • '{{='
  • '{{!'
  • '{{#' '/}}'
  • '{{^' '/}}'

License

Mostacho is released under the MIT License

Mostacho is copyrighted (C) 2012 by Antonio Vieiro (antonio#antonioshome.net)

About

Implementation of the mustache logic-less templates in Lua

Resources

License

Releases

No releases published
You can’t perform that action at this time.