Skip to content

Commit f07f147

Browse files
committed
fix readme
1 parent 31b2472 commit f07f147

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ micro-template.js
55

66
https://github.com/cho45/micro-template.js
77

8-
micro-template is a template engine on JavaScript which like embed js.
8+
micro-template is a template engine for JavaScript which is similar to embed.js.
99

10-
This is inspired from [John Resig's template]( http://ejohn.org/blog/javascript-micro-templating/ ) but has more efficient feature:
10+
This is inspired by [John Resig's template]( http://ejohn.org/blog/javascript-micro-templating/ ) but has more efficient features:
1111

12-
* Better error messages: show line-number in runtime errors
13-
* Support source map: debug is more easily on Chrome including syntax errors
14-
* Well tested: tested on node.js
15-
* Escape by default: all output is escaped by default for security
12+
* Better error messages: shows line numbers in runtime errors
13+
* Supports source maps: debugging is easier in Chrome, including for syntax errors
14+
* Well tested: works on Node.js
15+
* Escapes by default: all output is escaped for security
1616

1717
SYNOPSIS
1818
--------
@@ -69,7 +69,7 @@ const result = template('part1', {
6969
foo : 'bar',
7070
baz : 'piyo'
7171
});
72-
conole.log(result)
72+
console.log(result)
7373
```
7474

7575
SYNTAX
@@ -97,9 +97,9 @@ If the second argument is an **Object**, the template will be rendered immediate
9797
CUSTOM `get` FUNCTION
9898
---------------------
9999

100-
By default, micro-template uses `document.getElementById(id).innerHTML` to get template source from id.
100+
By default, micro-template uses `document.getElementById(id).innerHTML` to get the template source from the id.
101101

102-
To override this behaviour, you can set function to `template.get`.
102+
To override this behavior, you can set a function to `template.get`. For example, if your template files are in the `tmpl/` directory:
103103

104104
```js
105105
import { template } from 'micro-template';
@@ -109,7 +109,7 @@ template.get = function (id) { return require('fs').readFileSync('tmpl/' + id +
109109
DEFINE DATA VARIABLE SCOPE
110110
----------------------------
111111

112-
micro-template now always expands data variables as local variables in the template function. The template API only supports two arguments: the template source/id and the data object. All keys of the data object are available as local variables in the template code.
112+
micro-template always expands data variables as local variables in the template function. The template API only supports two arguments: the template source/id and the data object (or an array of property names for precompilation). All keys of the data object are available as local variables in the template code.
113113

114114
If the second argument is an **Array**, it is treated as a list of property names for the data object. In this case, the template function will be compiled with these property names as its local variables, and the function itself will be returned (not executed). This allows you to precompile a template for repeated use with the same set of variable names.
115115

0 commit comments

Comments
 (0)