Mullet logic-less HTML templates
- Extremely simple variable syntax is incapable of expressing logic in the templates.
- Templates are clean HTML which your HTML authoring tool and browser can display correctly. You can use the templates as a static HTML prototype for your user interface.
Example
Given the template:
<ul>
<li data-for="repos">
<a data-href="url" data-text="description"></a>
</li>
</ul>
Given the data in the hash:
{
repos: [
{ url: "hello", description: "Hello project" },
{ url: "world", description: "World project" }
]
}
Will render the output:
<ul>
<li>
<a href="hello">Hello project</a>
</li>
<li>
<a href="world">World project</a>
</li>
</ul>
Credits
- Inspired by ctemplate, mustache, Wicket, Cambridge and Thymeleaf.
- The Java code to parse templates uses the Validator.nu HTML Parser patched to report CDATA sections.
- The Java code to resolve variable values comes from JMustache.
- The Ruby code to parse templates uses html5lib patched to report CDATA sections.