Malline

0.4.0

Templating engine for Swift, similar to Handlebars & Mustache.
Naamio/malline

What's New

0.4.0

2018-05-18T17:53:21Z

Release 0.4

Added

  • White space in filters.
  • Ranged loops.

Changed

  • Several fixes.
  • Upgraded to Swift 4.1.

Malline

Swift Package Manager macOS Linux License: MIT Twitter: @hellonaamio

Malline is a simple and powerful template language for Swift. It provides a syntax similar to Handlebars & Mustache. If you're familiar with these, you will feel right at home with Malline.

Example

There are {{ articles.count }} articles.

<ul>
  {% for article in articles %}
    <li>{{ article.title }} by {{ article.author }}</li>
  {% endfor %}
</ul>
import Malline

struct Article {
  let title: String
  let author: String
}

let context = [
  "articles": [
    Article(title: "Limitations and Inevitable Demise of Blockchains", author: "Tauno Lehtinen"),
    Article(title: "Distributed Social Networks in Swift", author: "Tauno Lehtinen"),
  ]
]

let environment = Environment(loader: FileSystemLoader(paths: ["templates/"]))
let rendered = try environment.renderTemplate(name: context)

print(rendered)

The User Guide

Resources for Malline template authors to write Malline templates:

Resources to help you integrate Malline into a Swift project:

License

Malline is licensed under the MIT license. See LICENSE for more info.

Description

  • Swift Tools 4.0.0
View More Packages from this Author

Dependencies

  • None
Last updated: Thu Oct 17 2024 16:45:32 GMT-0900 (Hawaii-Aleutian Daylight Time)