docs: add complete README with quick-start and API reference
A Handlebars-style template engine for MoonBit.
moon add JshsJ/moontemplate
let ctx = [("name", "MoonBit")] let html = @moontemplate.render_template("Hello {{ name }}!", ctx) // html == "Hello MoonBit!"
{{ name }}
{{{ html }}}
{{#if show}}visible{{/if}}
{{#if flag}}yes{{else}}no{{/if}}
{{#each items}}{{ this }}{{/each}}
render_template(template, ctx)
compile(template) -> AST
render(ast, ctx) -> String
Context is an Array[(String, String)] of variable name-value pairs.
Array[(String, String)]
MIT
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802047560号
MoonTemplate
A Handlebars-style template engine for MoonBit.
Installation
Quick Start
Features
{{ name }}{{{ html }}}{{#if show}}visible{{/if}}{{#if flag}}yes{{else}}no{{/if}}{{#each items}}{{ this }}{{/each}}API
render_template(template, ctx)compile(template) -> ASTrender(ast, ctx) -> StringContext is an
Array[(String, String)]of variable name-value pairs.License
MIT