Skip to content

Commit c3bfc7a

Browse files
committed
Merge branch 'release/1.0.0'
2 parents 2577eae + 5e15f08 commit c3bfc7a

File tree

119 files changed

+10834
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+10834
-0
lines changed

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_size = 2
6+
indent_style = space
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[*.edge]
16+
insert_final_newline = false
17+
trim_trailing_whitespace=false

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
coverage
2+
node_modules
3+
.DS_Store
4+
npm-debug.log
5+
.idea
6+
dump.rdb
7+
test/unit/storage/sessions

.npmignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
coverage
2+
node_modules
3+
.DS_Store
4+
npm-debug.log
5+
test
6+
dump.rdb
7+
.travis.yml
8+
.editorconfig
9+
benchmarks
10+
.idea
11+
bin

.travis.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
language: node_js
2+
node_js:
3+
- node
4+
- 7.0.0
5+
- 6.0.0
6+
sudo: false
7+
install:
8+
- npm install
9+
notifications:
10+
slack:
11+
secure: m91zkX2cLVDRDMBAUnR1d+hbZqtSHXLkuPencHadhJ3C3wm53Box8U25co/goAmjnW5HNJ1SMSIg+DojtgDhqTbReSh5gSbU0uU8YaF8smbvmUv3b2Q8PRCA7f6hQiea+a8+jAb7BOvwh66dV4Al/1DJ2b4tCjPuVuxQ96Wll7Pnj1S7yW/Hb8fQlr9wc+INXUZOe8erFin+508r5h1L4Xv0N5ZmNw+Gqvn2kPJD8f/YBPpx0AeZdDssTL0IOcol1+cDtDzMw5PAkGnqwamtxhnsw+i8OW4avFt1GrRNlz3eci5Cb3NQGjHxJf+JIALvBeSqkOEFJIFGqwAXMctJ9q8/7XyXk7jVFUg5+0Z74HIkBwdtLwi/BTyXMZAgsnDjndmR9HsuBP7OSTJF5/V7HCJZAaO9shEgS8DwR78owv9Fr5er5m9IMI+EgSH3qtb8iuuQaPtflbk+cPD3nmYbDqmPwkSCXcXRfq3IxdcV9hkiaAw52AIqqhnAXJWZfL6+Ct32i2mtSaov9FYtp/G0xb4tjrUAsDUd/AGmMJNEBVoHtP7mKjrVQ35cEtFwJr/8SmZxGvOaJXPaLs43dhXKa2tAGl11wF02d+Rz1HhbOoq9pJvJuqkLAVvRdBHUJrB4/hnTta5B0W5pe3mIgLw3AmOpk+s/H4hAP4Hp0gOWlPA=

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<a name="1.0.0"></a>
2+
# 1.0.0 (2017-03-30)
3+
4+
5+
### Bug Fixes
6+
7+
* **tags:** allow nested each loops ([47ebd9c](https://github.com/poppinss/edge/commit/47ebd9c))
8+
9+
10+
### Features
11+
12+
* **ast:** add support for inline & block comments ([cb06a6b](https://github.com/poppinss/edge/commit/cb06a6b))
13+
* **ast:** add support for self closing tags ([016bf48](https://github.com/poppinss/edge/commit/016bf48))
14+
* **cache:** support for in-memory cache ([7e7b61b](https://github.com/poppinss/edge/commit/7e7b61b))
15+
* **component:** add support for define presenter ([7a90885](https://github.com/poppinss/edge/commit/7a90885))
16+
* **context:** add safe method to ignore escaping ([dfb7d46](https://github.com/poppinss/edge/commit/dfb7d46))
17+
* **each:** add support for inlcude inside each ([c876c2d](https://github.com/poppinss/edge/commit/c876c2d))
18+
* **each-tag:** add `isEven` and `isOdd` to ([9be4fbe](https://github.com/poppinss/edge/commit/9be4fbe))
19+
* **edge:** add support for cache ([3e46c85](https://github.com/poppinss/edge/commit/3e46c85))
20+
* **expression:** add support for conditional expression ([6b6d1d2](https://github.com/poppinss/edge/commit/6b6d1d2))
21+
* **globals:** add couple of globals ([f1bf6e0](https://github.com/poppinss/edge/commit/f1bf6e0))
22+
* **if:** add support for unary expression ([15ea142](https://github.com/poppinss/edge/commit/15ea142))
23+
* **layout:** add support for [@super](https://github.com/super) keyword ([8f79a9b](https://github.com/poppinss/edge/commit/8f79a9b))
24+
* **layout:** implement layouts ([56ed7c9](https://github.com/poppinss/edge/commit/56ed7c9))
25+
* **tag:** add debugger tag ([65ac9cd](https://github.com/poppinss/edge/commit/65ac9cd))
26+
* **tag:** add raw tag ([9498e63](https://github.com/poppinss/edge/commit/9498e63))
27+
* **tag:** add unless tag ([5c86bb0](https://github.com/poppinss/edge/commit/5c86bb0))
28+
* **tags:** implement yield tag ([e1445d8](https://github.com/poppinss/edge/commit/e1445d8))
29+
30+
31+

LICENSE.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
The MIT License (MIT)
2+
Copyright (c) 2016 Harminder Virk
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5+
6+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7+
8+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Edge
2+
> Templating with some fresh air
3+
4+
Edge is a logical templating engine for Node.js. The syntax language is naturally similar to Javascript, making it simpler to write and remember.
5+
6+
<br />
7+
8+
9+
[![NPM Version][npm-image]][npm-url]
10+
[![Build Status][travis-image]][travis-url]
11+
[![Downloads Stats][npm-downloads]][npm-url]
12+
[![Appveyor][appveyor-image]][appveyor-url]
13+
14+
<br />
15+
16+
---
17+
18+
<br />
19+
20+
## Features
21+
22+
1. Beautiful Syntax
23+
2. Encourages component based layout
24+
3. Runtime debugging via chrome devtools.
25+
4. Helpful error messages
26+
5. Support for Layouts
27+
6. Extraction markup via Partials.
28+
29+
The official documentation will soon be published on http://edge.adonisjs.com
30+
31+
### Usage
32+
33+
```js
34+
const edge = require('edge.js')
35+
36+
// configure cache
37+
edge.configure({
38+
cache: process.env.NODE_EV === 'production'
39+
})
40+
41+
// register views
42+
edge.registerViews(path.join(__dirname, 'views'))
43+
44+
// render view
45+
edge.render('welcome')
46+
```
47+
48+
## Running Tests
49+
50+
```bash
51+
# just the tests
52+
npm run test:local
53+
54+
# tests + report coverage on coveralls
55+
npm run test
56+
57+
# run tests on windows
58+
npm run test:win
59+
60+
# tests with local coverage report
61+
npm run coverage
62+
```
63+
64+
## Running Benchmarks
65+
66+
Make sure to install `nunjucks` before running benchmarks in comparison to nunjucks.
67+
68+
```
69+
node benchmarks/loop.js
70+
node benchmarks/conditionals.js
71+
```
72+
73+
[appveyor-image]: https://ci.appveyor.com/api/projects/status/github/poppinss/edge?branch=master&svg=true&passingText=Passing%20On%20Windows
74+
[appveyor-url]: https://ci.appveyor.com/project/thetutlage/edge
75+
76+
[npm-image]: https://img.shields.io/npm/v/edge.js.svg?style=flat-square
77+
[npm-url]: https://npmjs.org/package/edge.js
78+
79+
[travis-image]: https://img.shields.io/travis/poppinss/edge/master.svg?style=flat-square
80+
[travis-url]: https://travis-ci.org/poppinss/edge
81+
82+
[npm-downloads]: https://img.shields.io/npm/dm/edge.js.svg?style=flat-square

appveyor.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
environment:
2+
matrix:
3+
- nodejs_version: 'Stable'
4+
- nodejs_version: '6'
5+
- nodejs_version: '7'
6+
7+
init:
8+
git config --global core.autocrlf true
9+
10+
install:
11+
- ps: Install-Product node $env:nodejs_version
12+
- npm install
13+
14+
test_script:
15+
- node --version
16+
- npm --version
17+
- npm run test:win
18+
19+
build: off
20+
clone_depth: 1
21+
22+
matrix:
23+
fast_finish: true

benchmarks/conditional.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
'use strict'
2+
3+
const nunjucks = require('nunjucks')
4+
const Benchmark = require('benchmark')
5+
const suite = new Benchmark.Suite()
6+
const edge = new (require('../src/Edge'))()
7+
8+
const edgeStatement = `
9+
@if(username === 'virk')
10+
<p> Hello {{ username }} </p>
11+
@else
12+
<p> Hello anonymous </p>
13+
@endif
14+
`
15+
16+
const nunjucksStatement = `
17+
{% if username === 'virk' %}
18+
<p> Hello {{ username }} </p>
19+
{% else %}
20+
<p> Hello anonymous </p>
21+
{% endif %}
22+
`
23+
24+
function compileEdge () {
25+
return edge.compileString(edgeStatement)
26+
}
27+
28+
nunjucks.configure('', {
29+
noCache: true
30+
})
31+
32+
function compileNunjucks () {
33+
return nunjucks.precompileString(nunjucksStatement, {
34+
name: 'foo'
35+
})
36+
}
37+
38+
suite.add('Edge', function () {
39+
compileEdge()
40+
})
41+
.add('Nunjucks', function () {
42+
compileNunjucks()
43+
})
44+
.on('cycle', function (event) {
45+
console.log(String(event.target))
46+
})
47+
.on('complete', function () {
48+
console.log('Fastest is ' + this.filter('fastest').map('name'))
49+
})
50+
.run()

benchmarks/loop.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
'use strict'
2+
3+
const nunjucks = require('nunjucks')
4+
const Benchmark = require('benchmark')
5+
const suite = new Benchmark.Suite()
6+
const edge = new (require('../src/Edge'))()
7+
8+
const edgeStatement = `
9+
@each(user in users)
10+
{{ user.username }}
11+
@endeach
12+
`
13+
14+
const nunjucksStatement = `
15+
{% for user in users %}
16+
{{ user.username }}
17+
{% endfor %}
18+
`
19+
20+
function compileEdge () {
21+
return edge.compileString(edgeStatement)
22+
}
23+
24+
const env = new nunjucks.Environment({
25+
noCache: false
26+
})
27+
28+
function compileNunjucks () {
29+
return nunjucks.precompileString(nunjucksStatement, {
30+
name: 'foo',
31+
env: env
32+
})
33+
}
34+
35+
suite.add('Edge', function () {
36+
compileEdge()
37+
})
38+
.add('Nunjucks', function () {
39+
compileNunjucks()
40+
})
41+
.on('cycle', function (event) {
42+
console.log(String(event.target))
43+
})
44+
.on('complete', function () {
45+
console.log('Fastest is ' + this.filter('fastest').map('name'))
46+
})
47+
.run()

0 commit comments

Comments
 (0)