0.0.1-security • Published 3 years ago

at v0.0.1-security

Weekly downloads
29
License
-
Repository
-
Last release
3 years ago

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();
0.0.1-security

3 years ago

1.0.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago