<commit_before># Kiwi


## What is this?

Kiwi is a cool JavaScript template engine lovingly built from the ground up for Node.js with performance, extensibility, modularity and security in mind. It is compatible with most of [jQuery Template](http://api.jquery.com/category/plugins/templates/) syntax, and adds lots of features to it. This means Kiwi is:

* **Fast**. Insanely fast.
* **Completely asynchronous**. You have the absolute guarantee that not a single blocking call will be done after Kiwi has been initialized.
* **Easily extensible**. Three short lines of code are enough to create a new tag.
* **Incredibly powerful**, even for advanced features. Want dynamic template inheritance? Access individual block contents? Done!
* **Easy to set up**. One line of code and you can get started on [Express](http://expressjs.com) 3.x. You can even directly use your existing jQuery or [jqTpl](https://github.com/kof/node-jqtpl) templates.
* **Robust**. Kiwi is carefully tested before any change is pushed to the repository.
* **Full-featured**. Lots of filters are available, and it can't be easier to add your own if you want.
* **Secure**. All output is escaped by default.
* **Clean**. Kiwi won't mess with your prototypes, and won't extend any of the built-in JavaScript objects.


## Syntax

```html
<!DOCTYPE html>
<html>
  <head>
    <title>${title}</title>
  </head>
  <body>
    <p>
      {{if name}}
        Hello, ${name|capitalize}!
      {{else}}
        Hello, dear unknown!
      {{/if}}
    </p>
  </body>
</html>
```


## Installation

### Latest release

```bash
npm install kiwi
```

### Development version (may not be suited for production [yet])

```bash
npm install https://github.com/coolony/kiwi/tarball/master
```

## Usage

### Loading a template from string

```javascript
var kiwi = require('kiwi');

var template = '<p>Hello, ${name}!</p>';
new kiwi.Template(template).render({name: "Kiwi"}, function onRendered(err, rendered) {
  console.log('Rendered template is: ' + rendered);
});
```

### Loading a template from disk

```javascript
var kiwi = require('kiwi');

var template = new kiwi.Template().loadFile('template.kiwi', function onLoaded(err) {
  template.render({name: "Kiwi"}, function onRendered(err, rendered) {
    console.log('Rendered template is: ' + rendered);
  });
});
```


## Available tags

### ${}

#### Basic usage

The `${varOrExpression}` tag inserts the value of `varOrExpression` in the template. This is a shortcut for `{{= varOrExpression}}`.

```
// Template
<div>${a}</div>
<div>{{= a}}</div>

// Code
new Template(tpl).render({a: 'kiwi'}, callback);

// Result
<div>kiwi</div>
<div>kiwi</div>
```

#### Filter support

The `${}` tag optionally supports filters. This is an addition to jQuery Templates syntax.

```
// Template
<div>${a|replace('k', 'w')|capitalize}</div>

// Code
new Template(tpl).render({a: 'kiwi'}, callback);

// Result
<div>wiwi</div>
```<commit_msg>Corrected odd mistakes in README<commit_after># Kiwi


## What is this?

Kiwi is a cool JavaScript template engine lovingly built from the ground up for Node.js with performance, extensibility, modularity and security in mind. It is compatible with most of [jQuery Template](http://api.jquery.com/category/plugins/templates/) syntax, and adds lots of features to it. This means Kiwi is:

* **Fast**. Insanely fast.
* **Completely asynchronous**. You have the absolute guarantee that not a single blocking call will be done after Kiwi has been initialized.
* **Easily extensible**. Three short lines of code are enough to create a new tag.
* **Incredibly powerful**, even for advanced features. Want dynamic template inheritance? Access individual block contents? Done!
* **Easy to set up**. One line of code and you can get started on [Express](http://expressjs.com) 3.x. In most cases, you can even use your existing jQuery or [jqTpl](https://github.com/kof/node-jqtpl) templates without modification.
* **Robust**. Kiwi is carefully tested before any change is pushed to the repository.
* **Full-featured**. Lots of filters are available, and it can't be easier to add your own if you want.
* **Secure**. All output is escaped by default.
* **Clean**. Kiwi won't mess with your prototypes, and won't extend any of the built-in JavaScript objects.


## Syntax

```html
<!DOCTYPE html>
<html>
  <head>
    <title>${title}</title>
  </head>
  <body>
    <p>
      {{if name}}
        Hello, ${name|capitalize}!
      {{else}}
        Hello, dear unknown!
      {{/if}}
    </p>
  </body>
</html>
```


## Installation

### Latest release

```bash
npm install kiwi
```

### Development version (may not be suited for production [yet])

```bash
npm install https://github.com/coolony/kiwi/tarball/master
```

## Usage

### Loading a template from string

```javascript
var kiwi = require('kiwi');

var template = '<p>Hello, ${name}!</p>';
new kiwi.Template(template).render({name: "Kiwi"}, function onRendered(err, rendered) {
  console.log('Rendered template is: ' + rendered);
});
```

### Loading a template from disk

```javascript
var kiwi = require('kiwi');

var template = new kiwi.Template().loadFile('template.kiwi', function onLoaded(err) {
  template.render({name: "Kiwi"}, function onRendered(err, rendered) {
    console.log('Rendered template is: ' + rendered);
  });
});
```


## Available tags

### ${}

#### Basic usage

The `${varOrExpression}` tag inserts the value of `varOrExpression` in the template. This is a shortcut for `{{= varOrExpression}}`.

```
// Template
<div>${a}</div>
<div>{{= a}}</div>

// Code
new Template(tpl).render({a: 'kiwi'}, callback);

// Result
<div>kiwi</div>
<div>kiwi</div>
```

#### Filter support

The `${}` tag optionally supports filters.

```
// Template
<div>${a|replace('k', 'w')|capitalize}</div>

// Code
new Template(tpl).render({a: 'kiwi'}, callback);

// Result
<div>wiwi</div>
```
{'fraction_non_alphanumeric': 0.15674940496429784, 'fraction_numerical': 0.00034002040122407346, 'mean_word_length': 4.196996466431095, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '390469', 'n_tokens_mistral': 1863, 'n_tokens_neox': 1769, 'n_words': 660}