eco

https://github.com/eudoxia0/eco.git

git clone 'https://github.com/eudoxia0/eco.git'

(ql:quickload :eco)
7

Eco - Fast, flexible, designer-friendly templates.

Build Status

Goals

Usage

A basic template (.eco extension) looks like this:

<% deftemplate (index title &optional posts) () %>
  <!DOCTYPE html>
  <html>
    <head>
      <title><%= title %></title>
    </head>
    <body>
      <% if posts %>
        <h1>Recent Posts</h1>
        <ul id="post-list">
          <% loop for (title . snippet) in posts %>
            <li><%= title %> - <%= snippet %></li>
          <% end %>
        </ul>
      <% else %>
        <span>No recent posts.</span>
      <% end %>
    </body>
  </html>
<% end %>

To load this template, put this in your system definition file:

(:eco-template "filename")

To execute the template:

(eco-template:index "My Blog" nil)

Note: Eco is designed to be output-agnostic, so by default it will not autoescape HTML. Use the e function for that. You have been warned.

Tags

Options

Reference

deftemplate

Syntax:

<% deftemplate name (&rest args) (&rest options) %>
  <body>
<% end %>

Defines a template.

Examples

if

Syntax:

<% if cond %>
  true branch
<% else %>
  false branch
<% end %>

Implementation

Eco uses esrap to parse templates, which it then compiles down to Common Lisp code.

License

Copyright (c) 2014-2015 Fernando Borretti (eudoxiahp@gmail.com)

Licensed under the MIT License.