Skip to content
This repository has been archived by the owner on Dec 25, 2022. It is now read-only.

blitmap/mustache.lua

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 13 commits ahead of zxc:master.

Latest commit

 

Git stats

Files

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

{{ mustache.lua }}

What?

Mustache is a logic-free templating language

Why?

BECAUSE MUSTACHES! >:{

Status

Done

  • {{normal_tags}}
  • {{{unescaped}}} {{&tags}}
  • {{! comment tags }}
  • {{^inverted_sections}}
  • {{ . }}
  • Dictionaries
  • Lists
  • Lambdas
  • Boolean-True
  • Nil/False/Empty-List

Extensions

  • {{?section}}printed only once, even if list{{/section}}

Todo

  • {{>partials}}
  • {{= =}} (set delimeters)
  • Use Defunkt's Mustache examples for tests

Usage

Running the included tests:

 lua tests.lua

Rendering a template string:

	local mustache = require('mustache')

	local template = 'hello {{thing}}!'
	local env = { thing = 'world' }

	print(mustache.render(template, env))

Rendering a template file:

	local mustache = require('mustache')

	print(mustache.renderfile('example.mustache'))

About

The Mustache templating language in Lua

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%