cadenza 0.7.0.rc1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cadenza.rb +15 -0
- data/lib/cadenza/base_renderer.rb +26 -1
- data/lib/cadenza/context.rb +141 -9
- data/lib/cadenza/error.rb +13 -0
- data/lib/cadenza/filesystem_loader.rb +27 -0
- data/lib/cadenza/lexer.rb +52 -1
- data/lib/cadenza/nodes/block_node.rb +17 -3
- data/lib/cadenza/nodes/boolean_inverse_node.rb +11 -0
- data/lib/cadenza/nodes/constant_node.rb +10 -0
- data/lib/cadenza/nodes/document_node.rb +22 -0
- data/lib/cadenza/nodes/filter_node.rb +20 -1
- data/lib/cadenza/nodes/for_node.rb +42 -26
- data/lib/cadenza/nodes/generic_block_node.rb +22 -1
- data/lib/cadenza/nodes/if_node.rb +55 -29
- data/lib/cadenza/nodes/inject_node.rb +24 -1
- data/lib/cadenza/nodes/operation_node.rb +41 -1
- data/lib/cadenza/nodes/text_node.rb +9 -0
- data/lib/cadenza/nodes/variable_node.rb +13 -0
- data/lib/cadenza/parser.rb +82 -940
- data/lib/cadenza/racc_parser.rb +911 -0
- data/lib/cadenza/text_renderer.rb +12 -2
- data/lib/cadenza/version.rb +1 -1
- metadata +21 -30
@@ -1,13 +1,23 @@
|
|
1
1
|
require 'stringio'
|
2
2
|
|
3
3
|
module Cadenza
|
4
|
+
# The {TextRenderer} is the standard rendering logic for Cadenza. It will
|
5
|
+
# render an AST according to the rules specified in the Cadenza manual. See
|
6
|
+
# the manual for details.
|
4
7
|
class TextRenderer < BaseRenderer
|
5
|
-
|
8
|
+
|
9
|
+
# Renders the document given with the given context directly to a string
|
10
|
+
# returns.
|
11
|
+
# @param [DocumentNode] document_node the root of the AST you want to render.
|
12
|
+
# @param [Context] context the context object to render the document with
|
13
|
+
def self.render(document_node, context)
|
6
14
|
io = StringIO.new
|
7
|
-
new(io).render(
|
15
|
+
new(io).render(document_node, context)
|
8
16
|
io.string
|
9
17
|
end
|
10
18
|
|
19
|
+
private
|
20
|
+
|
11
21
|
def render_document(node, context, blocks)
|
12
22
|
if node.extends
|
13
23
|
# merge the inherited blocks onto this document's blocks to
|
data/lib/cadenza/version.rb
CHANGED
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cadenza
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.7.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- William Howard
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &81908300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.2
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *81908300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &81908010 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.6.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *81908010
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: racc
|
38
|
-
requirement: &
|
38
|
+
requirement: &81907760 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.4.6
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *81907760
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: nokogiri-diff
|
49
|
-
requirement: &
|
49
|
+
requirement: &81907510 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.1.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *81907510
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: yard
|
60
|
-
requirement: &
|
60
|
+
requirement: &81907290 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,21 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: pygments.rb
|
71
|
-
requirement: &70392920 !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
73
|
-
requirements:
|
74
|
-
- - ! '>='
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: *70392920
|
68
|
+
version_requirements: *81907290
|
80
69
|
- !ruby/object:Gem::Dependency
|
81
70
|
name: guard-rspec
|
82
|
-
requirement: &
|
71
|
+
requirement: &81906850 !ruby/object:Gem::Requirement
|
83
72
|
none: false
|
84
73
|
requirements:
|
85
74
|
- - ! '>='
|
@@ -87,10 +76,10 @@ dependencies:
|
|
87
76
|
version: '0'
|
88
77
|
type: :development
|
89
78
|
prerelease: false
|
90
|
-
version_requirements: *
|
79
|
+
version_requirements: *81906850
|
91
80
|
- !ruby/object:Gem::Dependency
|
92
81
|
name: guard-shell
|
93
|
-
requirement: &
|
82
|
+
requirement: &81906530 !ruby/object:Gem::Requirement
|
94
83
|
none: false
|
95
84
|
requirements:
|
96
85
|
- - ! '>='
|
@@ -98,7 +87,7 @@ dependencies:
|
|
98
87
|
version: '0'
|
99
88
|
type: :development
|
100
89
|
prerelease: false
|
101
|
-
version_requirements: *
|
90
|
+
version_requirements: *81906530
|
102
91
|
description:
|
103
92
|
email:
|
104
93
|
- whoward.tke@gmail.com
|
@@ -124,11 +113,13 @@ files:
|
|
124
113
|
- lib/cadenza/filters/standard_filters.rb
|
125
114
|
- lib/cadenza/text_renderer.rb
|
126
115
|
- lib/cadenza/filesystem_loader.rb
|
116
|
+
- lib/cadenza/racc_parser.rb
|
127
117
|
- lib/cadenza/blocks/standard_blocks.rb
|
128
118
|
- lib/cadenza/base_renderer.rb
|
129
119
|
- lib/cadenza/version.rb
|
130
120
|
- lib/cadenza/lexer.rb
|
131
121
|
- lib/cadenza/context.rb
|
122
|
+
- lib/cadenza/error.rb
|
132
123
|
- lib/cadenza.rb
|
133
124
|
homepage: http://github.com/whoward/Cadenza
|
134
125
|
licenses: []
|
@@ -145,9 +136,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
137
|
none: false
|
147
138
|
requirements:
|
148
|
-
- - ! '
|
139
|
+
- - ! '>='
|
149
140
|
- !ruby/object:Gem::Version
|
150
|
-
version:
|
141
|
+
version: '0'
|
151
142
|
requirements: []
|
152
143
|
rubyforge_project:
|
153
144
|
rubygems_version: 1.8.10
|