diff --git a/README.md b/README.md
index 5ec97052..59c3aa73 100644
--- a/README.md
+++ b/README.md
@@ -16,9 +16,12 @@ This Scroll is still a work in progress (specs, etc...)
Full BDD spec generated by Mocha:
+bob blihblih one
+0\.1\.2
+BOB
+fuuu
echo
delayed-echo
-bob blihblih one
ls default line: one
ls line: one
ls line: three
@@ -38,15 +41,15 @@ onE
two
thrEE
# TOC
- - [Formula](#formula)
+ - [Formula & variable substitution](#formula--variable-substitution)
- ['scroll' block](#scroll-block)
- ['summon' block and dependencies](#summon-block-and-dependencies)
- ['foreach' block](#foreach-block)
- ['transmute' block](#transmute-block)
-
-# Formula
+
+# Formula & variable substitution
should be parsed into list of string, with an additionnal property 'index' equals to 0.
```js
@@ -56,51 +59,67 @@ expect( book.formula.alert ).to.be.eql( [ 'bob' ] ) ;
expect( book.formula.list ).to.be.eql( [ 'one' , 'two' , 'three' ] ) ;
```
-
-# 'scroll' block
-should echoing echo.
+should substitute variable (aka formula) accordingly in 'scroll' block.
```js
cleanup( function() {
var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
- book.cast( 'echo' , function( error )
+ book.cast( 'kawarimi' , function( error )
{
expect( error ).not.ok() ;
- expect( getCastedLog( 'echo' ) ).to.be( 'echo\n' ) ;
+ expect( getCastedLog( 'kawarimi' ) ).to.be( 'bob blihblih one\n' ) ;
done() ;
} ) ;
} ) ;
```
-should echoing delayed-echo after one second.
+should substitute variable (aka formula) using filters.
```js
cleanup( function() {
var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
- book.cast( 'delayed-echo' , function( error )
+ book.cast( 'kawarimi-filter' , function( error )
{
expect( error ).not.ok() ;
- expect( getCastedLog( 'delayed-echo' ) ).to.be( 'delayed-echo\n' ) ;
+ expect( getCastedLog( 'kawarimi-filter' ) ).to.be( '0\\.1\\.2\nBOB\nfuuu\n' ) ;
done() ;
} ) ;
} ) ;
```
-should substitute variable (aka formula) accordingly in 'scroll' block.
+
+# 'scroll' block
+should echoing echo.
```js
cleanup( function() {
var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
- book.cast( 'kawarimi' , function( error )
+ book.cast( 'echo' , function( error )
{
expect( error ).not.ok() ;
- expect( getCastedLog( 'kawarimi' ) ).to.be( 'bob blihblih one\n' ) ;
+ expect( getCastedLog( 'echo' ) ).to.be( 'echo\n' ) ;
+ done() ;
+ } ) ;
+} ) ;
+```
+
+should echoing delayed-echo after one second.
+
+```js
+cleanup( function() {
+
+ var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
+
+ book.cast( 'delayed-echo' , function( error )
+ {
+ expect( error ).not.ok() ;
+ expect( getCastedLog( 'delayed-echo' ) ).to.be( 'delayed-echo\n' ) ;
done() ;
} ) ;
} ) ;
diff --git a/bdd-spec.md b/bdd-spec.md
index 53ff910f..c99a96f6 100644
--- a/bdd-spec.md
+++ b/bdd-spec.md
@@ -1,6 +1,9 @@
+bob blihblih one
+0\.1\.2
+BOB
+fuuu
echo
delayed-echo
-bob blihblih one
ls default line: one
ls line: one
ls line: three
@@ -20,15 +23,15 @@ onE
two
thrEE
# TOC
- - [Formula](#formula)
+ - [Formula & variable substitution](#formula--variable-substitution)
- ['scroll' block](#scroll-block)
- ['summon' block and dependencies](#summon-block-and-dependencies)
- ['foreach' block](#foreach-block)
- ['transmute' block](#transmute-block)
-
-# Formula
+
+# Formula & variable substitution
should be parsed into list of string, with an additionnal property 'index' equals to 0.
```js
@@ -38,51 +41,67 @@ expect( book.formula.alert ).to.be.eql( [ 'bob' ] ) ;
expect( book.formula.list ).to.be.eql( [ 'one' , 'two' , 'three' ] ) ;
```
-
-# 'scroll' block
-should echoing echo.
+should substitute variable (aka formula) accordingly in 'scroll' block.
```js
cleanup( function() {
var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
- book.cast( 'echo' , function( error )
+ book.cast( 'kawarimi' , function( error )
{
expect( error ).not.ok() ;
- expect( getCastedLog( 'echo' ) ).to.be( 'echo\n' ) ;
+ expect( getCastedLog( 'kawarimi' ) ).to.be( 'bob blihblih one\n' ) ;
done() ;
} ) ;
} ) ;
```
-should echoing delayed-echo after one second.
+should substitute variable (aka formula) using filters.
```js
cleanup( function() {
var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
- book.cast( 'delayed-echo' , function( error )
+ book.cast( 'kawarimi-filter' , function( error )
{
expect( error ).not.ok() ;
- expect( getCastedLog( 'delayed-echo' ) ).to.be( 'delayed-echo\n' ) ;
+ expect( getCastedLog( 'kawarimi-filter' ) ).to.be( '0\\.1\\.2\nBOB\nfuuu\n' ) ;
done() ;
} ) ;
} ) ;
```
-should substitute variable (aka formula) accordingly in 'scroll' block.
+
+# 'scroll' block
+should echoing echo.
```js
cleanup( function() {
var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
- book.cast( 'kawarimi' , function( error )
+ book.cast( 'echo' , function( error )
{
expect( error ).not.ok() ;
- expect( getCastedLog( 'kawarimi' ) ).to.be( 'bob blihblih one\n' ) ;
+ expect( getCastedLog( 'echo' ) ).to.be( 'echo\n' ) ;
+ done() ;
+ } ) ;
+} ) ;
+```
+
+should echoing delayed-echo after one second.
+
+```js
+cleanup( function() {
+
+ var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
+
+ book.cast( 'delayed-echo' , function( error )
+ {
+ expect( error ).not.ok() ;
+ expect( getCastedLog( 'delayed-echo' ) ).to.be( 'delayed-echo\n' ) ;
done() ;
} ) ;
} ) ;
diff --git a/spellbook b/spellbook
index a0770a1d..96e38510 100644
--- a/spellbook
+++ b/spellbook
@@ -49,7 +49,7 @@ formula
test/spellcast-test.js
cast
- dev-summon
+ npm-dev-install
scroll
${mocha} test/spellcast-test.js -R spec
@@ -61,7 +61,7 @@ formula
test/spellcast-test.js
cast
- dev-summon
+ npm-dev-install
scroll
${jshint} lib/spellcast.js test/spellcast-test.js