mustache

Mustache template rendering for Donna

By Nikolas Skyl <skylnikolas@gmail.com>MIT

mustache

Docs - Read Donna - mustache Test status

Mustache template rendering for Donna, backed by the C mustach library.

Simple values:

import mustache

pub fn greeting() -> String:
  mustache.render("Hello {{name}}", [#("name", "Donna")])

Structured values and list sections:

mustache.render_view_with_partials(
  "{{#posts}}{{> post_card}}{{/posts}}",
  [
    mustache.list("posts", [
      [mustache.text("title", "Hello"), mustache.text("url", "/hello/")],
      [mustache.text("title", "Leaf"), mustache.text("url", "/leaf/")]
    ])
  ],
  [#("post_card", "<a href=\"{{url}}\">{{title}}</a>\n")]
)

Run checks:

donna check
donna test