Why do all the template engines have so many features?
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
.travis.yml
README.md
index.js
package.json
test.js

README.md

Build status

@

@ is simple string interpolation for HTML.

Installation

npm install at

Usage

var at = require('at');
var template = at.compile('@(data.subject) is simplish!');

template({subject: '@'}) // @ is simplish!

Template syntax

If there’s an @ at the beginning of a line (excluding tabs and spaces at the beginning of a line), it’s treated as code. For example:

@ if (false) {
	<p>Strange things are happening.</p>
@ } else {
	<p>Oh, good.</p>
@ }

Outside of those code blocks, @(…) sections are treated as expressions and inserted as text, escaped as HTML. For raw HTML, use @!(…). It even counts parentheses, so you can do things like this:

Operator precedence! <code>(5 + 3) * (2 + 8) = @((5 + 3) * (2 + 8))</code>

If you have an ambiguity with @( appearing at the start of a line that should be a code block, just put a space between them:

@ (odd + prototypes).whatever();