colin-kiegel / twig-rust

rust port of the twig-php template library
http://colin-kiegel.github.io/twig-rust
Other
14 stars 0 forks source link

Build Status Coverage Status

Twig-Rust

a template engine for everyone writing web applications with Rust. By design Twig is

This library is derived from Twig (for PHP) and intended to become a fully compatible port - as far as it makes sense.

Current Status

EARLY ALPHA - This library is still in development and not yet ready for use. Take a look at the CHANGELOG for more details.

License

Twig-Rust is released under the new BSD license (code and documentation) - as is the original Twig for PHP.

Syntax and Semantics

Twig uses a syntax similar to the Django and Jinja template languages which inspired the Twig runtime environment.

<!DOCTYPE html>
<html>
    <head>
        <title>Display a thread of posts</title>
    </head>
    <body>
    <h1>{{ thread.title }}</h1>
    <ul>
      {% for post in thread.posts %}
        <li>{{ post }}</li>
      {% endfor %}
    </ul>
    {# note: this comment will be ignored #}
    </body>
</html>

Take a look at this introduction: Twig for template designers.

General Architecture

Twig is designed to be highly extensible:

The Lexer

The Parser

Extensions (work in progress)

Unit-Tests

More Information

Read the official documentation for more information. Note that it refers to the PHP implementation, of course.