Name: js-handler/node_modules/nodeunit/deps/ejs/Readme.md 
1:
# EJS
2:
 
3:
Embedded JavaScript templates.
4:
 
5:
## Installation
6:
 
7:
    $ npm install ejs
8:
 
9:
## Features
10:
 
11:
  * Complies with the [Express](http://expressjs.com) view system
12:
  * Static caching of intermediate JavaScript
13:
  * Unbuffered code for conditionals etc `<% code %>`
14:
  * Escapes html by default with `<%= code %>`
15:
  * Unescaped buffering with `<%- code %>`
16:
  * Supports tag customization
17:
  * Filter support for designer-friendly templates
18:
  * Client-side support
19:
 
20:
## Example
21:
 
22:
    <% if (user) { %>
23:
      <h2><%= user.name %></h2>
24:
    <% } %>
25:
 
26:
## Usage
27:
 
28:
    ejs.compile(str, options);
29:
    // => Function
30:
 
31:
    ejs.render(str, options);
32:
    // => str
33:
 
34:
## Options
35:
 
36:
  - `locals`          Local variables object
37:
  - `cache`           Compiled functions are cached, requires `filename`
38:
  - `filename`        Used by `cache` to key caches
39:
  - `scope`           Function execution context
40:
  - `debug`           Output generated function body
41:
  - `open`            Open tag, defaulting to "<%"
42:
  - `close`           Closing tag, defaulting to "%>"
43:
 
44:
## Custom tags
45:
 
46:
Custom tags can also be applied globally:
47:
 
48:
    var ejs = require('ejs');
49:
    ejs.open = '{{';
50:
    ejs.close = '}}';
51:
 
52:
Which would make the following a valid template:
53:
 
54:
    <h1>{{= title }}</h1>
55:
 
56:
## Filters
57:
 
58:
EJS conditionally supports the concept of "filters". A "filter chain"
59:
is a designer friendly api for manipulating data, without writing JavaScript.
60:
 
61:
Filters can be applied by supplying the _:_ modifier, so for example if we wish to take the array `[{ name: 'tj' }, { name: 'mape' },  { name: 'guillermo' }]` and output a list of names we can do this simply with filters:
62:
 
63:
Template:
64:
 
65:
    <p><%=: users | map:'name' | join %></p>
66:
 
67:
Output:
68:
 
69:
    <p>Tj, Mape, Guillermo</p>
70:
 
71:
Render call:
72:
 
73:
    ejs.render(str, {
74:
        locals: {
75:
            users: [
76:
                { name: 'tj' },
77:
                { name: 'mape' },
78:
                { name: 'guillermo' }
79:
            ]
80:
        }
81:
    });
82:
 
83:
Or perhaps capitalize the first user's name for display:
84:
 
85:
    <p><%=: users | first | capitalize %></p>
86:
 
87:
## Filter list
88:
 
89:
Currently these filters are available:
90:
 
91:
  - first
92:
  - last
93:
  - capitalize
94:
  - downcase
95:
  - upcase
96:
  - sort
97:
  - sort_by:'prop'
98:
  - size
99:
  - length
100:
  - plus:n
101:
  - minus:n
102:
  - times:n
103:
  - divided_by:n
104:
  - join:'val'
105:
  - truncate:n
106:
  - truncate_words:n
107:
  - replace:pattern,substitution
108:
  - prepend:val
109:
  - append:val
110:
  - map:'prop'
111:
  - reverse
112:
  - get:'prop'
113:
 
114:
## Adding filters
115:
 
116:
 To add a filter simply add a method to the `.filters` object:
117:
 
118:
```js
119:
ejs.filters.last = function(obj) {
120:
  return obj[obj.length - 1];
121:
};
122:
```
123:
 
124:
## client-side support
125:
 
126:
  include `./ejs.js` or `./ejs.min.js` and `require("ejs").compile(str)`.
127:
 
128:
## License
129:
 
130:
(The MIT License)
131:
 
132:
Copyright (c) 2009-2010 TJ Holowaychuk <[email protected]>
133:
 
134:
Permission is hereby granted, free of charge, to any person obtaining
135:
a copy of this software and associated documentation files (the
136:
'Software'), to deal in the Software without restriction, including
137:
without limitation the rights to use, copy, modify, merge, publish,
138:
distribute, sublicense, and/or sell copies of the Software, and to
139:
permit persons to whom the Software is furnished to do so, subject to
140:
the following conditions:
141:
 
142:
The above copyright notice and this permission notice shall be
143:
included in all copies or substantial portions of the Software.
144:
 
145:
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
146:
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
147:
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
148:
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
149:
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
150:
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
151:
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.