handlebars 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +1 -2
  3. data/README.mdown +15 -7
  4. data/handlebars.gemspec +2 -5
  5. data/lib/handlebars.rb +5 -5
  6. data/lib/handlebars/context.rb +3 -12
  7. data/lib/handlebars/version.rb +1 -1
  8. data/spec/handlebars_spec.rb +1 -1
  9. metadata +47 -58
  10. data/.gitmodules +0 -3
  11. data/vendor/handlebars/.gitignore +0 -8
  12. data/vendor/handlebars/.jshintrc +0 -52
  13. data/vendor/handlebars/.npmignore +0 -10
  14. data/vendor/handlebars/.rspec +0 -1
  15. data/vendor/handlebars/Gemfile +0 -5
  16. data/vendor/handlebars/LICENSE +0 -19
  17. data/vendor/handlebars/README.markdown +0 -317
  18. data/vendor/handlebars/Rakefile +0 -109
  19. data/vendor/handlebars/bench/benchwarmer.js +0 -149
  20. data/vendor/handlebars/bench/handlebars.js +0 -172
  21. data/vendor/handlebars/bin/handlebars +0 -193
  22. data/vendor/handlebars/dist/handlebars.js +0 -2201
  23. data/vendor/handlebars/dist/handlebars.runtime.js +0 -321
  24. data/vendor/handlebars/lib/handlebars.js +0 -14
  25. data/vendor/handlebars/lib/handlebars/base.js +0 -154
  26. data/vendor/handlebars/lib/handlebars/compiler/ast.js +0 -133
  27. data/vendor/handlebars/lib/handlebars/compiler/base.js +0 -21
  28. data/vendor/handlebars/lib/handlebars/compiler/compiler.js +0 -1267
  29. data/vendor/handlebars/lib/handlebars/compiler/index.js +0 -7
  30. data/vendor/handlebars/lib/handlebars/compiler/printer.js +0 -131
  31. data/vendor/handlebars/lib/handlebars/compiler/visitor.js +0 -13
  32. data/vendor/handlebars/lib/handlebars/runtime.js +0 -88
  33. data/vendor/handlebars/lib/handlebars/utils.js +0 -67
  34. data/vendor/handlebars/package.json +0 -35
  35. data/vendor/handlebars/spec/acceptance_spec.rb +0 -101
  36. data/vendor/handlebars/spec/parser_spec.rb +0 -433
  37. data/vendor/handlebars/spec/qunit_spec.js +0 -1370
  38. data/vendor/handlebars/spec/spec_helper.rb +0 -157
  39. data/vendor/handlebars/spec/tokenizer_spec.rb +0 -301
  40. data/vendor/handlebars/src/handlebars.l +0 -53
  41. data/vendor/handlebars/src/handlebars.yy +0 -109
  42. data/vendor/handlebars/src/parser-prefix.js +0 -1
  43. data/vendor/handlebars/src/parser-suffix.js +0 -4
@@ -1,53 +0,0 @@
1
-
2
- %x mu emu com par
3
-
4
- %%
5
-
6
- [^\x00]*?/("{{") {
7
- if(yytext.slice(-1) !== "\\") this.begin("mu");
8
- if(yytext.slice(-1) === "\\") yytext = yytext.substr(0,yyleng-1), this.begin("emu");
9
- if(yytext) return 'CONTENT';
10
- }
11
-
12
- [^\x00]+ { return 'CONTENT'; }
13
-
14
- <emu>[^\x00]{2,}?/("{{"|<<EOF>>) {
15
- if(yytext.slice(-1) !== "\\") this.popState();
16
- if(yytext.slice(-1) === "\\") yytext = yytext.substr(0,yyleng-1);
17
- return 'CONTENT';
18
- }
19
-
20
- <com>[\s\S]*?"--}}" { yytext = yytext.substr(0, yyleng-4); this.popState(); return 'COMMENT'; }
21
-
22
- <mu>"{{>" { this.begin("par"); return 'OPEN_PARTIAL'; }
23
- <mu>"{{#" { return 'OPEN_BLOCK'; }
24
- <mu>"{{/" { return 'OPEN_ENDBLOCK'; }
25
- <mu>"{{^" { return 'OPEN_INVERSE'; }
26
- <mu>"{{"\s*"else" { return 'OPEN_INVERSE'; }
27
- <mu>"{{{" { return 'OPEN_UNESCAPED'; }
28
- <mu>"{{&" { return 'OPEN_UNESCAPED'; }
29
- <mu>"{{!--" { this.popState(); this.begin('com'); }
30
- <mu>"{{!"[\s\S]*?"}}" { yytext = yytext.substr(3,yyleng-5); this.popState(); return 'COMMENT'; }
31
- <mu>"{{" { return 'OPEN'; }
32
-
33
- <mu>"=" { return 'EQUALS'; }
34
- <mu>"."/[} ] { return 'ID'; }
35
- <mu>".." { return 'ID'; }
36
- <mu>[\/.] { return 'SEP'; }
37
- <mu>\s+ { /*ignore whitespace*/ }
38
- <mu>"}}}" { this.popState(); return 'CLOSE'; }
39
- <mu>"}}" { this.popState(); return 'CLOSE'; }
40
- <mu>'"'("\\"["]|[^"])*'"' { yytext = yytext.substr(1,yyleng-2).replace(/\\"/g,'"'); return 'STRING'; }
41
- <mu>"'"("\\"[']|[^'])*"'" { yytext = yytext.substr(1,yyleng-2).replace(/\\'/g,"'"); return 'STRING'; }
42
- <mu>"@"[a-zA-Z]+ { yytext = yytext.substr(1); return 'DATA'; }
43
- <mu>"true"/[}\s] { return 'BOOLEAN'; }
44
- <mu>"false"/[}\s] { return 'BOOLEAN'; }
45
- <mu>[0-9]+/[}\s] { return 'INTEGER'; }
46
- <mu>[a-zA-Z0-9_$-]+/[=}\s\/.] { return 'ID'; }
47
- <mu>'['[^\]]*']' { yytext = yytext.substr(1, yyleng-2); return 'ID'; }
48
- <mu>. { return 'INVALID'; }
49
- <par>\s+ { /*ignore whitespace*/ }
50
- <par>[a-zA-Z0-9_$-/]+ { this.popState(); return 'PARTIAL_NAME'; }
51
-
52
- <INITIAL,mu><<EOF>> { return 'EOF'; }
53
-
@@ -1,109 +0,0 @@
1
- %start root
2
-
3
- %%
4
-
5
- root
6
- : program EOF { return $1; }
7
- ;
8
-
9
- program
10
- : simpleInverse statements { $$ = new yy.ProgramNode([], $2); }
11
- | statements simpleInverse statements { $$ = new yy.ProgramNode($1, $3); }
12
- | statements simpleInverse { $$ = new yy.ProgramNode($1, []); }
13
- | statements { $$ = new yy.ProgramNode($1); }
14
- | simpleInverse { $$ = new yy.ProgramNode([], []); }
15
- | "" { $$ = new yy.ProgramNode([]); }
16
- ;
17
-
18
- statements
19
- : statement { $$ = [$1]; }
20
- | statements statement { $1.push($2); $$ = $1; }
21
- ;
22
-
23
- statement
24
- : openInverse program closeBlock { $$ = new yy.BlockNode($1, $2.inverse, $2, $3); }
25
- | openBlock program closeBlock { $$ = new yy.BlockNode($1, $2, $2.inverse, $3); }
26
- | mustache { $$ = $1; }
27
- | partial { $$ = $1; }
28
- | CONTENT { $$ = new yy.ContentNode($1); }
29
- | COMMENT { $$ = new yy.CommentNode($1); }
30
- ;
31
-
32
- openBlock
33
- : OPEN_BLOCK inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1]); }
34
- ;
35
-
36
- openInverse
37
- : OPEN_INVERSE inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1]); }
38
- ;
39
-
40
- closeBlock
41
- : OPEN_ENDBLOCK path CLOSE { $$ = $2; }
42
- ;
43
-
44
- mustache
45
- : OPEN inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1]); }
46
- | OPEN_UNESCAPED inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1], true); }
47
- ;
48
-
49
-
50
- partial
51
- : OPEN_PARTIAL partialName CLOSE { $$ = new yy.PartialNode($2); }
52
- | OPEN_PARTIAL partialName path CLOSE { $$ = new yy.PartialNode($2, $3); }
53
- ;
54
-
55
- simpleInverse
56
- : OPEN_INVERSE CLOSE { }
57
- ;
58
-
59
- inMustache
60
- : path params hash { $$ = [[$1].concat($2), $3]; }
61
- | path params { $$ = [[$1].concat($2), null]; }
62
- | path hash { $$ = [[$1], $2]; }
63
- | path { $$ = [[$1], null]; }
64
- | DATA { $$ = [[new yy.DataNode($1)], null]; }
65
- ;
66
-
67
- params
68
- : params param { $1.push($2); $$ = $1; }
69
- | param { $$ = [$1]; }
70
- ;
71
-
72
- param
73
- : path { $$ = $1; }
74
- | STRING { $$ = new yy.StringNode($1); }
75
- | INTEGER { $$ = new yy.IntegerNode($1); }
76
- | BOOLEAN { $$ = new yy.BooleanNode($1); }
77
- | DATA { $$ = new yy.DataNode($1); }
78
- ;
79
-
80
- hash
81
- : hashSegments { $$ = new yy.HashNode($1); }
82
- ;
83
-
84
- hashSegments
85
- : hashSegments hashSegment { $1.push($2); $$ = $1; }
86
- | hashSegment { $$ = [$1]; }
87
- ;
88
-
89
- hashSegment
90
- : ID EQUALS path { $$ = [$1, $3]; }
91
- | ID EQUALS STRING { $$ = [$1, new yy.StringNode($3)]; }
92
- | ID EQUALS INTEGER { $$ = [$1, new yy.IntegerNode($3)]; }
93
- | ID EQUALS BOOLEAN { $$ = [$1, new yy.BooleanNode($3)]; }
94
- | ID EQUALS DATA { $$ = [$1, new yy.DataNode($3)]; }
95
- ;
96
-
97
- partialName
98
- : PARTIAL_NAME { $$ = new yy.PartialNameNode($1); }
99
- ;
100
-
101
- path
102
- : pathSegments { $$ = new yy.IdNode($1); }
103
- ;
104
-
105
- pathSegments
106
- : pathSegments SEP ID { $1.push($3); $$ = $1; }
107
- | ID { $$ = [$1]; }
108
- ;
109
-
@@ -1 +0,0 @@
1
- // BEGIN(BROWSER)
@@ -1,4 +0,0 @@
1
-
2
- // END(BROWSER)
3
-
4
- module.exports = handlebars;